Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author k00ni

    (@k00ni)

    Hi,

    can you please describe what you did different in comparison to the situation, when it worked? Could please add a link to the faulty installation?

    We faced problems with accordions and tabs ourselves, because you usually use # together with an ID to be able to identify your target tab or accordion part.

    We currently refine the plugin to help dodging problems with accordions and tabs, expect a release soon.

    Kinda regards

    Thread Starter mrcoulson

    (@mrcoulson)

    Hey, there. I actually figured it out yesterday and didn’t get to come back here and post about it yet. It’s really sort of embarrassing. I had some JavaScript referencing an element on the page and then I removed that element but forgot about the JavaScript and it caused an error that broke the plugin. I started to try to debug the plugin and found the JS error in the console and realized what mistake I had made. I did, however, end up tweaking the plugin’s JS to handle a / before the #anchorname since some of our nav links are coded like href="/#anchorname".

    Nonetheless, awesome plugin. Very easy to use if you don’t make an unrelated dumb JavaScript error ??

    Thanks for getting back in touch! Have an awesome day!

    Plugin Author k00ni

    (@k00ni)

    Hey mrcoulson,

    no problem. I am interested in your case about the / before #anchorname. Why do you need this? How did you extend the code and is it maybe something you want in the official version?

    Regards

    Thread Starter mrcoulson

    (@mrcoulson)

    Hey!

    The site we have is just one page and all of the nav links point to #anchor elements on the page. That was working a-okay. Then we needed to add a contact form as a separate page but with the same nav items. So, I just added the /so the anchors are /#anchor. That way, the same nav can be used on the contact form page to point to site root #anchor.

    Example: <a href="/#features">Features and Pricing</a> refers to either “go to an anchor called features on this page” or “go to an anchor called features on the home page” if you’re on the \contact page. Does that make sense?

    Here’s what I did to the code:

    Right at the top of the ('a[href*=#]').click() function, I check to see what the first character in the href is:

    var intSubstrIndex; // To set substr index.
    	// If the anchor begins with a /...
    	if (jQuery(this).attr("href").charAt(0) == "/") {
    		intSubstrIndex = 2;
    	}
    	else {
    		intSubstrIndex = 1;
    	}

    Then set the index for substr for offset and top. Like:

    var offset = jQuery('[name="' + jQuery.attr(this, 'href').substr(intSubstrIndex) + '"]').offset();

    That way I’m altering it so I get “features” whether the href is “/#features” or “#features”.

    I don’t know if it’s something that would be useful in the official version. As it is, it’s really specific for us.

    Jeremy

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘The plugin no longer jumps the page past the menu’ is closed to new replies.