將JavaScript的jQuery庫(kù)中表單轉(zhuǎn)化為JSON對(duì)象的方法
963
2024-03-21
本文實(shí)例為大家分享了jquery實(shí)現(xiàn)返回頂部效果的全部代碼,供大家參考,具體內(nèi)容如下
效果圖:
實(shí)現(xiàn)代碼:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>返回頂部</title> <style type="text/css"> *{ margin: 0; padding: 0; } .wrap{ height: 2000px; } .gotop{ display: block; width: 32px; height: 32px; background-color: red; text-align: center; text-decoration: none; font-size: 14px; font-weight: bold; color: white; line-height: 32px; position: fixed; right:50px; bottom:50px; opacity: 0; /*top: 500px;*/ } </style> </head> <body> <div class="wrap"> <a class="gotop">TOP</a> </div> <script type="text/javascript" src="http://www.gimoo.net/t/1903/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(function(){ // 當(dāng)滾動(dòng)條滾動(dòng)大于200時(shí)出現(xiàn),未大于,消失 $(window).scroll(function(){ if($(document).scrollTop()<200){ // alert("kk"); $(".gotop").stop().animate({ opacity: 0 },1000) } else{ $(".gotop").show().stop().animate({ opacity: 1 },1000) } }) // 返回頂部 $(".gotop").on("click",function(){ $("html body").animate({ scrollTop:0 },1000) }) }) </script> </body> </html>
希望本文所述對(duì)大家學(xué)習(xí)javascript程序設(shè)計(jì)有所幫助。
#免責(zé)聲明#
本站[綠夏技術(shù)導(dǎo)航]提供的一切軟件、教程和內(nèi)容信息僅限用于學(xué)習(xí)和研究目的;不得將上述內(nèi)容用于商業(yè)或者非法用途,否則,一切后果請(qǐng)用戶(hù)自負(fù)。本站信息來(lái)自網(wǎng)絡(luò)收集整理,版權(quán)爭(zhēng)議與本站無(wú)關(guān)。您必須在下載后的24個(gè)小時(shí)之內(nèi),從您的電腦或手機(jī)中徹底刪除上述內(nèi)容。如果您喜歡該程序或內(nèi)容,請(qǐng)支持正版,購(gòu)買(mǎi)注冊(cè),得到更好的正版服務(wù)。我們非常重視版權(quán)問(wèn)題,如有侵權(quán)請(qǐng)郵件[admin@lxwl520.com]與我們聯(lián)系進(jìn)行刪除處理。敬請(qǐng)諒解!