javascript - Execute if statement everytime when the url hash changed -
i using easytab create tab page, therefore page won't refresh when switching tab i'd need create function hidden buttons specific tab.
so javascript, have built checker url hash
//hiding 30d/90d/1y button feed var feedpanelchecker = location.hash; if(feedpanelchecker == "#panel-feeds"){ $("#30days").css("display","none"); $("#12weeks").css("display","none"); $("#12months").css("display","none"); } });
but don't know how make excute everytime when hash tag change, should id use .change()
? seem input type elements only
use
onhashchange event
, fires when window's hash changes
window.addeventlistener("hashchange", function() { var feedpanelchecker = location.hash; if (feedpanelchecker == "#panel-feeds") { $("#30days").css("display", "none"); $("#12weeks").css("display", "none"); $("#12months").css("display", "none"); }; });
Comments
Post a Comment