[jQuery] when document.location.hash also activate the class inside of <A>

[jQuery] when document.location.hash also activate the class inside of <A>


I have index.html#members_kihon_image10 . When I enter it in URL it
perfectly loads what I need.
What I can't do is to also make a class selected inside of a tag on
hash click?
here is html
<div class="cur" style="position:absolute; width:94px; height:
58px;"><a href="#members_kihon_image10" class="scrollToId_img10_lyr1"
onClick="mActive(this); javascript:loadintoIframe('video-frame',
'videos/3.html'); " name="img10"><img src="../../images/off.gif"
border=1 name="img10" onMouseOver="mOver(this)" onMouseOut="mOut
(this)" onClick="mActive(this)" /></a></div>
here is the class that has to be activated on hash click (on regular
mouse click it works)
class="scrollToId_img10_lyr1"
here is the jquery javascript which should be added with some that
would activate the class inside of A:
$(document).ready( function () {
if (document.location.hash) {
var pnp = document.location.hash.split('_');
$("a[href='"+pnp[0]+"']").click();
if (pnp[1]) {
     $("a[href='"+pnp[0]+'_'+pnp[1]+"']").click();
}
if (pnp[2]) {
$("a[href='"+location.hash+"']").click();
}
}
    if ($.browser.mozilla) {
        $('a').click(function() {
            this.blur();
        });
    }
    });
Should be very easy, right?
Ilia



































    • Topic Participants

    • hello