<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>jQuery 事件 傳參</title> <style> * { margin: 0; padding: 0; } #top-right-buttons { position: absolute; top: 120px; right: 10px; color: white; font-size: 15px } .top-right-button { width: 140px; height: 30px; background-color: rgba(0, 0, 255, 0.4); padding: 8px 10px; margin-bottom: 5px; border: 1px solid transparent; border-radius: 20px; text-align: center; line-height: 30px; } .top-right-button:hover { border: 1px solid rgba(255, 200, 200, 1); } </style> </head> <body> <div id="top-right-buttons"> <div class="top-right-button" id="海河柳林地區">海河柳林地區</div> <div class="top-right-button" id="宜興埠片區">宜興埠片區</div> <div class="top-right-button" id="銀河片區">銀河片區</div> </div> <script> function handleLayer(event) { /*地點定位。 * mars3d.point.getCameraView(viewer, !0);*/ switch (event.target.id) { case "海河柳林地區": viewer.mars.centerAt({ y: 38.988967, x: 117.695381, z: 855.79, heading: 360, pitch: -45.4, roll: 360 }, 1); break; case "宜興埠片區": viewer.mars.centerAt({ y: 38.988967, x: 117.695381, z: 855.79, heading: 360, pitch: -45.4, roll: 360 }, 1); break; case "銀河片區": viewer.mars.centerAt({ y: 38.988967, x: 117.695381, z: 855.79, heading: 360, pitch: -45.4, roll: 360 }, 1); } } $("#top-right-buttons").click(handleLayer); </script> </body> </html>
jQuery 事件 傳參.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.