jQuery實(shí)現(xiàn)邊框動態(tài)效果的實(shí)例代碼
話不多說、靜態(tài)效果圖如下
實(shí)代碼如下
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .myDiv{ width: 300px; height: 200px; border: 1px solid rgba(0,0,0,0.2); margin: 50px ; position: relative; } .topLine{ width: 0px; height: 1px; background: black; position:absolute; left: 0; top: -1px; } .bottomLine{ width: 0px; height: 1px; background: black; position:absolute; left: 0; bottom: -1px; } .leftLine{ width: 1px; height: 0px; background: black; position:absolute; left: -1; bottom: -1px; } .rightLine{ width: 1px; height: 0px; background: black; position:absolute; right: -1px; top: -1px; } </style> </head> <body> <div class="myDiv"> <div class="topLine"></div> <div class="rightLine"></div> <div class="bottomLine"></div> <div class="leftLine"></div> </div> <div class="myDiv"> <div class="topLine"></div> <div class="rightLine"></div> <div class="bottomLine"></div> <div class="leftLine"></div> </div> <script type="text/javascript" src='http://libs.baidu.com/jquery/2.0.0/jquery.js'></script> <script> $(function(){ $(".myDiv").mouseover(function(){ $(this).find(".topLine,.bottomLine").stop().animate({"width":"300px"}); $(this).find(".rightLine,.leftLine").stop().animate({"height":"200px"}); }) $(".myDiv").mouseout(function(){ $(this).find(".topLine,.bottomLine").stop().animate({"width":"0px"}); $(this).find(".rightLine,.leftLine").stop().animate({"height":"0px"}); }) }) </script> </body> </html>
總結(jié)
以上就是這篇文章的全部內(nèi)容了,剛興趣的朋友們可以自己動手操作下看看動態(tài)效果,真的非常不錯,希望對大家的學(xué)習(xí)或者工作能有一定的幫助。如果有疑問大家可以留言交流,小編會盡快給大家回復(fù)。
相關(guān)文章
jQuery實(shí)現(xiàn)的選擇商品飛入文本框動畫效果完整實(shí)例
這篇文章主要介紹了jQuery實(shí)現(xiàn)的選擇商品飛入文本框動畫效果,結(jié)合完整實(shí)例形式分析了jQuery動態(tài)操作頁面元素屬性實(shí)現(xiàn)動畫效果的方法,涉及jQuery的事件綁定、元素遍歷及屬性操作等相關(guān)技巧,需要的朋友可以參考下2016-08-08jQuery實(shí)現(xiàn)右側(cè)顯示可向左滑動展示的深色QQ客服效果代碼
這篇文章主要介紹了jQuery實(shí)現(xiàn)右側(cè)顯示可向左滑動展示的深色QQ客服效果代碼,涉及jQuery控制頁面元素樣式動態(tài)變換的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-10-10jQuery實(shí)現(xiàn)的多屏圖像圖層切換效果實(shí)例
這篇文章主要介紹了jQuery實(shí)現(xiàn)的多屏圖像圖層切換效果,可實(shí)現(xiàn)多個(gè)圖層的點(diǎn)擊切換效果,設(shè)計(jì)jQuery鼠標(biāo)事件及樣式的操作技巧,需要的朋友可以參考下2015-05-05jQuery簡單實(shí)現(xiàn)banner圖片切換
本篇文章主要是對使用jQuery簡單實(shí)現(xiàn)banner圖片切換的示例代碼進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01bootstrap+jquery項(xiàng)目引入文件報(bào)錯的解決方法
這篇文章主要介紹了bootstrap+jquery項(xiàng)目引入文件的常見報(bào)錯問題,下面小編給大家?guī)砹艘恍╁e誤及錯誤的解決方法,需要的朋友可以參考下2018-01-01jQuery實(shí)現(xiàn)電梯導(dǎo)航案例詳解(切換?網(wǎng)頁區(qū)域)
日常生活中用手機(jī),電腦瀏覽網(wǎng)頁時(shí),滑到了頁面下端后想返回頂部 或 跳轉(zhuǎn)到頁面別的版塊,用鼠標(biāo)滾動很麻煩,網(wǎng)頁電梯導(dǎo)航就可以很方便的精準(zhǔn)到達(dá)目標(biāo)版塊,本文給大家分享jquery電梯導(dǎo)航案例詳解,感興趣的朋友一起看看吧2022-05-05jQuery實(shí)現(xiàn)點(diǎn)擊小圖顯示大圖代碼分享
這篇文章主要介紹了jQuery實(shí)現(xiàn)點(diǎn)擊小圖顯示大圖效果,功能實(shí)現(xiàn)非常簡單,推薦給大家,有需要的小伙伴可以參考下。2015-08-08