博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery类级别插件--返回顶部,底部,去到任何部位
阅读量:4661 次
发布时间:2019-06-09

本文共 853 字,大约阅读时间需要 2 分钟。

先引入js:

<script type="text/javascript" src="jquery.js" ></script>
<script type="text/javascript" src="towhere.js" ></script>

 

假设页面:

        去到底部        返回顶部        
去到500处
去到1000处

 

使用方法:

$(function(){        $('#to-bottom').click(function(){            $.toBottom();        });        $('#to-top').click(function(){            $.toTop();        });        $('#to-where1').click(function(){            $.toWhere(500);        });        $('#to-where2').click(function(){            $.toWhere(1000);        });                /*                  $.toBottom();        去向底部,$.toBottom(0.1)--[0.1-可选参数-运动速度],默认0.3         $.toTop();           返回顶部,调整同上         $.toWhere();         到任何处,$.toWhere(500,0.1)--[500-必填到达何处,0.1--可选速度],默认0.3                  */    });

 

插件下载:

转载于:https://www.cnblogs.com/barrior/p/4166513.html

你可能感兴趣的文章