I have a page with a number of hidden divs that are toggled with a click on a corresponding button. Pretty basic jQuery stuff. Now, what I'd like to do is have a relative hyperlink (for instance, ) in one of these divs that opens another div and scrolls the page to this element. I can get it to do the scroll to visible when the link is not connected to an event in jQuery, and I can open the div when the link is connect to jQuery. But I want to do both at the same time!
Here is my handler
$('.B2BHL').click(function() {
var month = this.href.substring(this.href.indexOf('#') + 1);
//$('#' + month + 'div').show();
window.location.href = this.href;
});
When the show()
call is commented out, it scrolls. When it is uncommented, it opens the div, but doesn't scroll to it
I found the following two questions on Stack Overflow:
But neither is working for me. I am using IE 11. Can anyone advise?
Thanks