一句jQuery代碼實(shí)現(xiàn)返回頂部效果(簡單實(shí)用)
使用方法:
只需引用jQuery庫和YesTop插件,然后一句代碼就可以實(shí)現(xiàn)返回頂部:
引用代碼:
<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="http://hovertree.com/texiao/yestop/inc/jquery.yestop.js"></script>
使用代碼:
<script type="text/javascript"> $(document).ready(function () { $.fn.yestop(); }) </script>
也就是:
$.fn.yestop();
這句代碼就可以了。
當(dāng)然還有高級的設(shè)置,如換圖片,設(shè)置圖標(biāo)為圓形,設(shè)置位置,設(shè)置時間等等。詳情請查看其他Demo。
完整代碼,保存到HTML文件就可以體驗(yàn)效果:
<!DOCTYPE html> <html> <head><meta charset="UTF-8"> <title>YesTop - HoverTree</title><meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="http://hovertree.com/texiao/yestop/inc/jquery.yestop.js"></script> <style> body { margin: 0px;font-family:Arial }a{color:blue} </style> </head> <body> <div style="text-align:center;width:100%;margin:0px auto;"> <h1>YesTop</h1> A jQuery Plugin<br /> <a >Demo 1</a> <a >Demo 2</a> <a >Demo 3</a> <a >Demo 4</a> <a >Images</a> </div> <div style="height: 360px;background-color: #66FF66;"> </div> <div style="width:100%;text-align:center;height:200px">© hovertree.com</div> <div style="height: 200px; visibility: visible; background-color: Olive"> </div><div style="height:200px;background-color:burlywood"></div><div style="height:200px;background-color:darkorchid"></div> <div style="height: 200px; visibility: visible; background-color:gray"> </div> <div style="height:200px;background-color:blue"></div> <div style="height:200px;background-color:red"></div> <div style="height:200px;background-color:yellow"></div> <div style="height:200px;background-color:yellowgreen"></div> <div style="height:800px;background-color:white"></div> <script type="text/javascript"> $(document).ready(function () { $.fn.yestop(); }) </script> </body> </html>
以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持腳本之家!
相關(guān)文章
jquery實(shí)現(xiàn)div拖拽寬度示例代碼
本例為大家演示個比較簡單的div拖動,另外可根據(jù)自己的需求,添加相應(yīng)的代碼,實(shí)現(xiàn)自己的想要的效果,具體如下,喜歡的請支持下2013-07-07JqueryMobile動態(tài)生成listView并實(shí)現(xiàn)刷新的兩種方法
本篇文章主要是對JqueryMobile動態(tài)生成listView并實(shí)現(xiàn)刷新的兩種方法進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-03-03jQuery 函數(shù)實(shí)例分析【函數(shù)聲明、函數(shù)表達(dá)式、匿名函數(shù)等】
這篇文章主要介紹了jQuery 函數(shù),結(jié)合實(shí)例形式分析了jquery函數(shù)聲明、函數(shù)表達(dá)式、匿名函數(shù)等相關(guān)使用技巧,需要的朋友可以參考下2020-05-05jQuery實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出提示信息的地圖熱點(diǎn)效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出提示信息的地圖熱點(diǎn)效果,涉及jquery鼠標(biāo)事件及頁面元素樣式的動態(tài)操作技巧,非常具有實(shí)用價值,需要的朋友可以參考下2015-08-08JQuery移動頁面開發(fā)之屏幕方向改變與滾屏的實(shí)現(xiàn)
這篇文章主要介紹了JQuery移動頁面開發(fā)之隨屏幕方向改變與滾屏的實(shí)現(xiàn),通過相關(guān)兩個事件的添加來達(dá)到響應(yīng)移動設(shè)備上操作的效果,需要的朋友可以參考下2015-12-12