I have the following code on my website, which basically checks to see if there is a hash in the URL, and if there is then it triggers a click on a tab. This works fine apart from in Chrome/Safari – any ideas how I can fix this?
jQuery(document).ready(function() {
if(window.location.hash){
$("a#viewapart").trigger('click');
}
});
It doesn’t work if I substitute alert(‘hello’); so it is just not recognizing if(window.location.hash) for some reason.
Thanks!
You’re likely executing it before the carousel script has been initialized and bound all clicks.
You need to execute it after the carousel script is been initialized.