I came up with some jquery to come from an external page and to show the hidden div (#section2) on another page. The problem is that I can't seem to get #section3 to work the same as #section2. Here's the code.
jQuery(document).ready(function() {
var hash = window.location.hash.substring(0);
jQuery(hash).css({
"display": "block"
});
if (hash != '#section2') {
jQuery('#section1').css({
"display": "block"
});
}
else {
jQuery('#section1').css({
"display": "none"
});
}
});
I tried else if
if(hash != '#section3'){
jQuery('#section1').css({"display":"block"});
}
I can only seem to get either #section2 or #section3 to appear with section1 hidden when their respective urls with the hash are entered. I can't seem to get them both of them to function correctly at the same time. Basically I need some thing that will produce
if(hash != '#section2' or '#section3')
. I'm learning so any help would be much appreciated.