Mouse Scroll Event

How to handle mouse scroll event…? plz help me

Please elaborate on what you are trying to achieve. This is a way too generic question.

Hi Kim,
thanks for reply me…

i wnt 2 handle mouse scroll up and down events for sticky header.

if any other solutions is there plz suggest me.

Let’s first make sure you are doing the right thing. What do you want to use the scroll events for? What do you want to do, when a scroll event is triggered?

i wnt to handle below javascript event into vaadin.

$(window).scroll(function() {
if ($(this).scrollTop() > 81){
document.getElementById(“stickey”).style.display=“block”;
document.getElementById(“nStickey”).style.display=“none”;

}
else{
   document.getElementById("stickey").style.display="none";
document.getElementById("nStickey").style.display="block";
}

});

So you want to have some kind of a header at the top of the page and keep the header in postion at the top, even though the user scrolls? Is this correct? Hard to tell, since your code doesn’t quite tell me what the “sticky” blocks are.

page have 2 headers.if the user scroll the page, “nStickey” header shown automatically.​"stickey" ll hide.

You’ll need to implement a JavaScript extension, which executes your JavaScript code.

If you are unfamiliar with extensions, I recommend readin the
chapter in the Book of Vaadin describing extensions
. After that, you can read about creating
JavaScript extensions
, which allows you to intergate your JavaScript code without any GWT coding.

PS. You might also find in the documentation, that it is possible to execute JavaScript code through the Page object, but in your case I wouldn’t recommend it. The problem with that is, that the JavaScript is then only executed once. Depending on your implementation, you might run into problems where your JavaScript isn’t re-executed if refreshing the browser and/or navigating away and then back to your view.

Thanks for the tips and the quick answers !. its working now

I’ve got the same problem - could you please share your result?

Best regards

Daniel