實(shí)現(xiàn)功能如下:
1. 二維碼展示功能;
2. “回到頂部”功能。(選擇“全屏預(yù)覽”,滑動(dòng)滾動(dòng)條,查看回到頂部功能)
效果圖:
圖(1) 初始效果
圖(2) 鼠標(biāo)懸浮效果
實(shí)例代碼:
<!doctype html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <title>工具條</title> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <style type="text/css"> body{ background-color:#69C; } .toolbar{ position:fixed; left:50%; bottom:5px; margin-left:-26px; } .toolbar-item{ position:relative; display:block; width:52px; height:52px; background-image:url(/upload/otherpic18/160208u95waa2sfwt27hwh.png); background-repeat:no-repeat; margin-top:1px; -webkit-transition:background-position 1s; -moz-transition:background-position 1s; -ms-transition:background-position 1s; -o-transition:background-position 1s; transition:background-position 1s; } .toolbar-item-wenxin{ background-position:0 -798px; } .toolbar-item-wenxin:hover{ background-position:0 -860px; } .toolbar-item-feedback{ background-position:0 -426px; } .toolbar-item-feedback:hover{ background-position:0 -488px; } .toolbar-item-app{ background-position:0 -550px; } .toolbar-item-app:hover{ background-position:0 -612px; } .toolbar-item-top{ background-position:0 -674px; } .toolbar-item-top:hover{ background-position:0 -736px; } .toolbar-layer{ position:absolute; right:46px; bottom:-10px; width:172px; background-image:url(/upload/otherpic18/160208u95waa2sfwt27hwh.png); background-repeat:no-repeat; opacity:0; filter:alpha(opacity=0); -webkit-transform-origin:95% 95%; -moz-transition-origin:95% 95%; -ms-transition-origin:95% 95%; -o-transition-origin:95% 95%; transform-origin:95% 95%; -webkit-transition:scale(0.01); -moz-transition:scale(0.01); -ms-transition:scale(0.01); -o-transition:scale(0.01); transform:scale(0.01); -webkit-transition:all 1s; -moz-transition:all 1s; -ms-transition:all 1s; -o-transition:all 1s; transition:all 1s; } .toolbar-item-wenxin .toolbar-layer{ height:212px; background-position:0 0; } .toolbar-item-app .toolbar-layer{ height:194px; background-position:0 -222px; } .toolbar-item:hover .toolbar-layer{ opacity:1; filter:alpha(opacity=100); -webkit-transition:scale(1); -moz-transition:scale(1); -ms-transition:scale(1); -o-transition:scale(1); transform:scale(1); } </style> <script type="text/javascript"> $(window).on('load',function(){ $('#backTop').on('click',go); $(window).on('scroll',function(){ checkPosition($(window).height()); }); checkPosition($(window).height());//防止剛開始刷新頁(yè)面,返回頂部沒(méi)有隱藏的問(wèn)題,先讓它執(zhí)行一次,使其fadeOut }) //到達(dá)頂部 function go(){ $('html,body').scrollTop(0); } //檢測(cè)位置 function checkPosition(pos){ if($(window).scrollTop() > pos){ $('#backTop').fadeIn();//滾動(dòng)超過(guò)一個(gè)屏的寬度,就顯示 }else{ $('#backTop').fadeOut(); } } </script> </head> <body> <div class="toolbar"> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="toolbar-item toolbar-item-wenxin"> <span class="toolbar-layer"></span> </a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="toolbar-item toolbar-item-feedback"></a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="toolbar-item toolbar-item-app"> <span class="toolbar-layer"></span> </a> <a id="backTop" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="toolbar-item toolbar-item-top"> </a> </div> <!--出現(xiàn)滾動(dòng)條--> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> <p>1</p> </body> </html>
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)建站chinadenli.net,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
文章題目:js實(shí)現(xiàn)常見的工具條效果-創(chuàng)新互聯(lián)
當(dāng)前網(wǎng)址:http://chinadenli.net/article24/djjcje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、網(wǎng)站設(shè)計(jì)公司、靜態(tài)網(wǎng)站、網(wǎng)站維護(hù)、網(wǎng)站收錄、網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容
營(yíng)銷型網(wǎng)站建設(shè)知識(shí)