开发者

How to avoid repeated hashchange events with jquery bbq and dependent controls?

开发者 https://www.devze.com 2023-03-25 13:30 出处:网络
Say I\'ve got three select boxes all of which are set up to $.bbq.pushState onChange. If the selects also have interdependencies (e.g. selecting a different model changes what colors are available) ch

Say I've got three select boxes all of which are set up to $.bbq.pushState onChange. If the selects also have interdependencies (e.g. selecting a different model changes what colors are available) changing one select can result in window.hashchange firing multiple times: once from the initial change, and again for each of the dependent selects' change handlers.

If the hashchange handler is开发者_运维知识库 expensive (or not idempotent) this can be a problem. What's the best way to prevent this from happening?

0

精彩评论

暂无评论...
验证码 换一张
取 消