my page content is big and there is a link. when user mouse over the link then a div is popup but when i scroll the browser window then div position should change when it appears. how to write and show the div by jquery in such a way that div should open and adjust position when user drag the scroll bar top & down. please advice how to do it very simply.
hey, you can use pure CSS e.g. position:fixed;top:30px;left:30px;z-index:100;
second jQuery solution:
CSS:
<style type="text/css">
#mainmenu{position:absolute;left:30px;top:30px;z-index:100;}
#content{height:2000px;}
</style>
jQuery
<script type="text/javascript">
$(function(){
$(window).scroll(function(){
$('#mainmenu').animate({top:$(window).scrollTop()+30},500);
});
});
</script>
HTML:
<div id="mainmenu">
<ul>
<li><a href="">link 1</a></li>
<li><a href="">link 2</a></li>
<li><a href="">link 3</a></li>
<li><a href="">link 4</a></li>
</ul>
</div>
<div id="content">
</div>
Cheers
G.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With