很基礎(chǔ)的一個功能,點(diǎn)擊左下角的圖標(biāo)按鈕,地圖的整個div會變大,變大預(yù)覽之后,再次點(diǎn)擊圖標(biāo)按鈕,地圖的整個div會變小,恢復(fù)原樣,兩個圖標(biāo)在地圖界面的放大和縮小時間不斷的切換圖標(biāo)狀態(tài)(箭頭向里面,或者箭頭向外面)

圖片.png

圖片.png
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <style> #scale { background: #FFFFFF url('../img/suo.png') no-repeat scroll 0px 0px; background-position: center center; position: absolute; left: 3%; bottom: 40%; width: 26px; height: 26px; } #scale.current { background: #FFFFFF url("../img/fang.png") no-repeat scroll 0px 0px; background-position: center center; } #updmap { border: 1px solid #1E90FF; width: 400px; height: 200px } </style> </head> <body> <div id="scale" style=""></div> <div id="updmap"> </div> </body> <script> $("#scale").toggle(function() { $(this).toggleClass("current"); $("#updmap").css({ "width": "950px", "height": "400px", }); }, function() { $(this).toggleClass("current"); $("#updmap").css({ "width": "400px", "height": "200px", }); }); </script></html>總結(jié)
以上所述是小編給大家介紹的jQuery實(shí)現(xiàn)點(diǎn)擊圖標(biāo)div循環(huán)放大縮小功能,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對武林網(wǎng)網(wǎng)站的支持!
新聞熱點(diǎn)
疑難解答