jquery - Set the Div at the end of user window screen -
what trying create div displayed @ end of user screen display news , should straight forwards job , div disappear page ! if zoom in or zoom out browser come @ position should !! problem ?
<style> #news_div{ background-color: red; width:800px; height:40px; padding:0; margin:0; position: fixed; z-index: 1; } </style> </head> <body> <div id="news_div"> news </div> <script> $( function(){ $("#news_div").offset({ top : $(window).height(), })});
ok, top
property specifies distance of top of div
top if window. if set div
's top
property window's top
div
outside window or outside visible area.
you have subtract height of div
bottom:
$(function() { $("#news_div").offset({ top : $(window).height() -$('#news_div').height() }) });
jquery css3
No comments:
Post a Comment