看板 Web_Design 關於我們 聯絡資訊
https://developers.google.com/maps/documentation/javascript/markers#animate 想請問下面這行程式碼要如何理解呢?(黃標處) function toggleBounce() { if (marker.getAnimation() !== null) { marker.setAnimation(null); } else { marker.setAnimation(google.maps.Animation.BOUNCE); } } ps. 文件說明: BOUNCE 指出標記在原地彈跳。 彈跳標記會持續彈跳,直到它的 animation 屬性明確設成 null 才會停止。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 219.84.234.215 ※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1459368560.A.DC2.html
Rinorune: 如果marker.getAnimation()的回傳值不等於null 03/31 14:51
Rinorune: 應該是指 maker.animation !== null 03/31 14:52
Rinorune: 即是判斷marker.animation是否為null(有沒有東西) 03/31 14:54
arjuna: 本來在跳的變成不跳,不跳的讓他開始跳 03/31 15:04
shter: 如果有值(!==null)就把它設成null 04/01 01:20
oasisrose: 謝謝大家,web板真溫馨 04/01 03:00
yyc1217: 可以理解為hasAnimation()或isAnimated()吧 04/01 17:03
rarex: 看function name嘛~toggle就是on->off off->on 04/01 21:08