Javascript 用于IE7的hashchange polyfill,可以跟踪每个刻度上的多个事件
我需要在每次勾选时触发哈希更改事件不止一次 我当前的多边形填充看起来像这样Javascript 用于IE7的hashchange polyfill,可以跟踪每个刻度上的多个事件,javascript,dom-events,Javascript,Dom Events,我需要在每次勾选时触发哈希更改事件不止一次 我当前的多边形填充看起来像这样 //If the hashchange event is missing implement it hashchangeSupported || (function() { //save the current hash for reference next cycle var lastHash = location.hash; //check the hash for changes eve
//If the hashchange event is missing implement it
hashchangeSupported || (function() {
//save the current hash for reference next cycle
var lastHash = location.hash;
//check the hash for changes every tick
setInterval(function() {
//if the hash is different since the last tick then
// fire a hash change event.
if(lastHash !== location.hash) {
trigger('hashchange', window);
lastHash = location.hash;
}
}, 1);
});
问题在于,如果哈希值每勾选更新一次以上,它仍然只触发一个哈希更改事件。我正在寻找一种方法来检查每勾选一次以上的更改
我知道这要求很多,我怀疑如果没有getter和setter,这是不可能的,但我知道有更好的程序员,我需要一些第二意见。没有getter和setter,这是不可能的。没有getter和setter,这是不可能的