本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下
我们提供的服务有:网站设计制作、做网站、微信公众号开发、网站优化、网站认证、金牛ssl等。为上1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的金牛网站制作公司
当滚动条滚动到内容区域的时候,侧边导航条定位到屏幕,不再动,并且点击导航条跳转到内容所在的位置;
<!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 src="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="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>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。
当前名称:基于jQuery实现定位导航位置效果
标题链接:https://www.cdcxhl.com/article10/jpoodo.html
成都网站建设公司_创新互联,为您提供网站改版、全网营销推广、、网站设计、品牌网站建设、用户体验
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联