jQuery實現點選圖示div迴圈放大縮小功能
很基礎的一個功能,點選左下角的圖示按鈕,地圖的整個div會變大,變大預覽之後,再次點選圖示按鈕,地圖的整個div會變小,恢復原樣,兩個圖示在地圖介面的放大和縮小時間不斷的切換圖示狀態(箭頭向裡面,或者箭頭向外面)

圖片.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>
原文作者:祈澈姑娘
技術部落格: https://www.jianshu.com/u/05f416aefbe1
90後前端妹子,愛程式設計,愛運營,愛折騰。
堅持總結工作中遇到的技術問題,堅持記錄工作中所所思所見,歡迎大家一起探討交流。