css中的行間距的代碼
732
2024-10-23
本文實例為大家分享了Android九宮格圖片展示的具體代碼,供大家參考,具體內容如下
當滾動條滾動到內容區域的時候,側邊導航條定位到屏幕,不再動,并且點擊導航條跳轉到內容所在的位置;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <style> *{ padding: 0; margin: 0; } .left{ float: left; padding: 0 0 328px 0; } .left div{ width: 800px; height: 300px; line-height: 300px; text-align: center; font-size: 30px; background: gray; margin: 10px 0; } .nav{ position: absolute; right:20px; top: 20px; } .nav div{ width: 100px; height: 80px; line-height: 80px; text-align: center; background: pink; margin: 10px 0; cursor: pointer; } .bottom{ overflow: hidden; width: 100%; position: relative; } </style> <title>Document</title> </head> <body> <img style="width:100%" src="http://www.gimoo.net/t/1905/o_1bsmo1kpn1hp61bm0176i1bk618uo9.jpg" alt=""> <div class="bottom"> <div class="left"> <div class="one leftDiv" id="one"> 一 </div> <div class="conOne leftDiv" id="two"> 二 </div> <div class="leftDiv" id="three "> 三 </div> <div class="leftDiv" id="four"> 四 </div> </div> <div class="nav"> <div class="one navDiv">one</div> <div class="two navDiv">two</div> <div class="three navDiv">three</div> <div class="four navDiv">four</div> </div> </div> <script src="http://www.gimoo.net/t/1905/jquery.js"></script> <script> $(window).scroll(function(e){ console.log($(window).scrollTop()); if ($(window).scrollTop() >$('#one').offset().top) { $('.nav').css({'position':'fixed'}); console.log('ss'); } else{ $('.nav').css({'position':'absolute'}); } }) $('.nav div').click(function(){ var i = $('.navDiv').index(this); var x = $('.leftDiv').eq(i).offset().top; $('html, body').animate({scrollTop:x+'px'},500); }) </script> </body> </html>
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持綠夏網。
#免責聲明#
本站[綠夏技術導航]提供的一切軟件、教程和內容信息僅限用于學習和研究目的;不得將上述內容用于商業或者非法用途,否則,一切后果請用戶自負。本站信息來自網絡收集整理,版權爭議與本站無關。您必須在下載后的24個小時之內,從您的電腦或手機中徹底刪除上述內容。如果您喜歡該程序或內容,請支持正版,購買注冊,得到更好的正版服務。我們非常重視版權問題,如有侵權請郵件[admin@lxwl520.com]與我們聯系進行刪除處理。敬請諒解!