How to use css to put an item just above the top of the screen? -
i'm working on page animates slides out of screen. how it.
var previousoffset = ($(window).height())*-1; previousoffset = previousoffset+'px' $('.current').animate({ top: previousoffset, }, 500, function(){...}
i wondering, there cleaner way it, pure css, without measuring height of of screen. currently, item has position:absolute
, not requierment.
to clear css of .current is:
.current{ top: -"height of screen"; position: absolute; }
i without "height of screen".
this may depend heavily on other markup, try setting height of .current
element 100% , deal percentages. implicitly handle resizing of window you.
note must set html & body element 100% work.
css
html, body { margin:0; height:100%; } .current { position:absolute; height:100%; width:100%; }
js
$('#nextbutton').click(function(){ $('.current').animate({ top: '-100%' }, 500, function(){ // }); });
demo
Comments
Post a Comment