Copy code The code is as follows:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> body { margin:0px; padding:0px; margin-top:60px; margin-bottom:60px; } #div_nav_zone_right { position:absolute; float:right; z-index:3; width:120px; height:100px; right:0px; top: 332px; background-color:#999; } #div_nav_zone_right_bottom { position:absolute; float:right; z-index:3; width:120px; height:100px; right:0px; top: 532px; background-color:#CCC; } #div_ul { position:fixed; height:50px; } ul,li { margin:0px; } li { list-style:none; } </style> <script type="text/javascript" src="js/jquery.js" ></script> <script type="text/javascript"> $(function() { moveDiv(); //Page initialization execution $(window).scroll(function(){ moveDiv(); moveRightBottomDiv(); }); }); //Center right side function moveDiv() { var scrollTop = $(document).scrollTop(); //The height of the top of the scroll bar hidden var clientHeight = $(window).height(); //Height of web page content area //Set the position to var hei = $("#div_nav_zone_right").css("height"); hei = hei.replace("px",""); var newPosY = scrollTop + (clientHeight-hei)/2; $("#div_nav_zone_right").css("top",newPosY+"px"); } //100 pixels below the right side function moveRightBottomDiv() { var scrollTop = $(document).scrollTop(); //The height of the top of the scroll bar hidden var clientHeight = $(window).height(); //Height of web page content area //Set the position to var hei = $("#div_nav_zone_right_bottom").css("height"); hei = hei.replace("px",""); var newPosY = clientHeight + scrollTop - hei - 100; $("#div_nav_zone_right_bottom").css("top",newPosY+"px"); } </script> </head> <body> 1 <br/>2 <br/>3 <br/>4 <br/>5 <br/>6 <br/>7 <br/>8 <br/>9 <br/>10 <br/> <p>sd</p> <p>f</p> <p> </p> <p>ads</p> <p>f</p> <p>ads</p> <p> <input type="button" name="button" id="button" value="Submit" onclick="clk()" /> </p> <p>ad</p> <p>sf AS D as d S D </p> <p> </p> <p>ads</p> <p>f</p> <p>ads</p> sad S D a d A D a <div id="div_nav_zone_right" > <ul> <li>Sidebar Menu 1</li> <li>Sidebar Menu 2</li> <li>Sidebar Menu 3</li> <li>Sidebar Menu 4</li> </ul> </div> <div id="div_nav_zone_right_bottom" > <ul> <li>Sidebar Menu 1</li> <li>Sidebar Menu 2</li> <li>Sidebar Menu 3</li> <li>Sidebar Menu 4</li> </ul> </div> </body> </html> |
<<: The table table uses: nth-child() to achieve alternate color change and alignment
>>: Complete steps to install MySQL 5.5 on CentOS
Table of contents Introduction Description Naming...
I have written such an article before, but I used...
Table of contents 1. Download the virtual machine...
This article mainly introduces the sample code of...
Table of contents Use two-way binding data in v-m...
Preface Nginx is a lightweight HTTP server that u...
This article shares the specific code for JavaScr...
1. Put the mask layer HTML code and the picture i...
I spent almost two hours trying various methods. ...
First, let's simulate the data coming from th...
After creating a container locally, you can creat...
Don't be surprised if you see some kind of und...
The two parameters innodb_flush_log_at_trx_commit...
Download link: Operating Environment CentOS 7.6 i...
Nginx can use its reverse proxy function to imple...