jquery - How to place a div in a way the user always needs to scroll to see it? -


i want build website div on top, 100% in "height" (regardless of users screen size or size of browser window), every other content on site, "hidden" , user needs scroll down watch it.

  1. problem: every time use 100% in div height, , float div beneath first one, second div moves far bottom of site. don't find way use height:100% in way.

  2. problem: want place content in first div center center. in example, , combine above described example.

i hope description clear enough, welcome.

regards.

use jquery finding resolution , set in element's width , height:

html:

<div id='test'></div> 

jquery script:

$(document).ready(function(){     var w = $(window).width();     var h = $(window).height();      $('#test').css({width: w, height: h, background: '#bbb', position: 'absolute', top: "0", left: 0}); }); 

look here


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -