我有一個奇怪的問題,jquery插件和選項越過寫入。jquery插件選項不正確擴展和覆蓋
如果我像這樣安裝插件它works fine。
$("#social-media").socialMedia({ url: "http://css-tricks.com", social: [ { name: "facebook", widget: "like_small" }, { name: "twitter", widget: "small" }, { name: "googlePlus", widget: "small" } ] });
如果我補充一點,我需要覆蓋一個額外的選項,facebook like button does not load。
$("#social-media").socialMedia({ url: "http://css-tricks.com", social: [ { name: "facebook", widget: "like_small" }, { name: "twitter", widget: "small" }, { name: "googlePlus", widget: "small" } ], facebook: { id: 195838043798363 } });
這是正確的答案。忽略我的。 – Jivings 2012-02-23 18:33:18
這裏是jsfiddle來證明這個答案:http://jsfiddle.net/UwvDM/4/ – Jivings 2012-02-23 18:34:34
@Jivings感謝jsfiddle!其實,我喜歡你回答更好。雖然我的解決方案很簡單,但您的插件設計更好。 – s4y 2012-02-23 18:40:14