Reputation: 34036
i am pretty new to jquery and hope this is the right place to ask.
my problem is the following. when i mouseover a certain element on a page, i want that a certain image is displayed in the top right corner of the page, no matter where the it is currently scrolled.
how can i achieve that? thanks a lot!
Upvotes: 1
Views: 1027
Reputation: 8784
You want to use the position: fixed
CSS property with top: 0; right: 0
.
If you need IE 6 support, check this page.
$("#triggerId").mouseover(function (e) {
$("#cornerImageId").show();
});
And have in your CSS:
#cornerImageId {
position: fixed;
top: 0;
right: 0;
}
Upvotes: 3
Reputation: 8648
$(function(){
$("#certain_element").mouseover(function(){
$("#certain_img").css({position:"fixed",right:"0px",top:"0px"});
});
});
see working example on http://jsbin.com/orace/
Upvotes: 2