• Resolved jpdykeman

    (@jpdykeman)


    Hey, Malihu!

    First of all, congratulations on the Plugin. Awesome!

    I need your help.

    This happens in many links, however, as an example, we can use this one:

    Go to the Footer Menu > INSPETORIA ICMS> Cadastro.

    When clicking on this link the script goes through the item, stays for a few seconds and then finally finds the Accordion ID. And meanwhile, if you try to scroll with the mouse, you get “stuck”, even with the option “Stop page scrolling on mouse-wheel or touch-swipe” turned on. How to avoid this behavior? In Firefox the script opens the accordion, however, in chrome it does not work. What could be happening?

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author malihu

    (@malihu)

    Hello,

    Try this:
    Go to plugin settings and disable/uncheck “Enable different pages scrolling on all links” option.

    Save changes, test and let me know.

    • This reply was modified 3 years, 5 months ago by malihu.
    Thread Starter jpdykeman

    (@jpdykeman)

    Hey Malihu!

    I’m sorry for the delay. I noticed that some links were incorrect, but even fixing it, the best I could do was make the page scroll to the ID from the footer menu. This footer menu is a template for the Astra theme and is replicated on all pages. If I remove the option “Enable scrolling from different pages on all links (even those not handled by the plugin)” the way you suggested, it won’t work.

    Any other suggestion?

    Plugin Author malihu

    (@malihu)

    No problem. Try disabling “Scroll from/to different pages” option and let me know so I can check it.

    Thread Starter jpdykeman

    (@jpdykeman)

    Done. In firefox the anchor disappears and only the # appears.

    Plugin Author malihu

    (@malihu)

    I can’t see the changes. I think you need to clear the cache(?)

    Anyway, try this:

    • In plugin settings (re)enable both “Scroll from/to different pages” and “Enable different pages scrolling on all links”.
    • Enable (check) “Append the clicked link’s hash value to browser’s URL/address bar” option.
    • Save changes.
    • Add the following to your custom/additional CSS:
    :target + .eael-accordion-content{
      display: block !important;
    }

    Test and let me know 🙂

    Thread Starter jpdykeman

    (@jpdykeman)

    Sorry, I forgot to clear all cache. I made the adjustments and inserted the css. I don’t know why in firefox the sticky menu is above the anchor. In Chome it works fine, however, in both browsers I can’t close the accordion.

    Plugin Author malihu

    (@malihu)

    OK. I don’t know how your accordion worked without “page scroll to id” but the best way to solve this is via javascript. Can you add a js script in your theme?

    If yes, try this one:

    <script>
    (function($){
    	var scrollTimeout,
    		hash,
    		accordionElem=$(".eael-adv-accordion");
    	$(window).on("scroll",function(){
    		if(!accordionElem.length) return;
    		hash=window.location.hash ? window.location.hash.substring(1) : null
    		if (!scrollTimeout){
    	        scrollTimeout=setTimeout(function(){
    	            $("#"+hash+":not(.show)").trigger("click");
    	            scrollTimeout=null;
    	        },250);
    	    }
    	});
    })(jQuery);
    </script>

    You can add this script in your theme/child-theme footer.php template right before the closing body tag (</body>) or in a custom javascript field in your theme/plugin (without the <script> tags) if such field is available.

    Also, remove the previous CSS we added.

    Let me know

    Thread Starter jpdykeman

    (@jpdykeman)

    Hey Malihu! I think we´re getting there.

    With the script I can now close the accordion. However, when scrolling, it opens again. Is there a way to close and keep this way?

    The project without the plugin loses offset and smooth scrolling, but the accordion opens and closes normally in both browsers. But it´s not cool as your plugin.

    Please, take a look at the website. The best configuration I got was this one, and it didn’t have any problems in any of the browsers.

    Plugin Author malihu

    (@malihu)

    We’ll fix this. Please remove the js code (temporarily) so I can work on it.
    Let me know when you do, so I can modify it and sent you the updated one.

    Thread Starter jpdykeman

    (@jpdykeman)

    Ok, done!

    Plugin Author malihu

    (@malihu)

    Great. Add the updated js:

    <script>
    (function($){
    	var scrollTimeout,
    		hash,
    		accordionElem=$(".eael-adv-accordion");
    	$(window).on("scroll",function(){
    		if(!accordionElem.length) return;
    		hash=window.location.hash ? window.location.hash.substring(1) : null
    		if (!scrollTimeout){
    	        scrollTimeout=setTimeout(function(){
    	            if(hash) $("#"+hash+".eael-accordion-header:not(.show)").trigger("click");
    	            scrollTimeout=null;
    	        },250);
    	    }
    	});
    	$(document).on("click",".eael-accordion-header.show",function(e){
    		history.replaceState(null,null,window.location.pathname);
    	});
    })(jQuery);
    </script>

    and test it. It should work exactly how we want it.

    Also, since you don’t use/need links highlighting, go to plugin settings and set the “Highlight selector(s)” option value to:

    .nothing

    and hit Save Changes.

    Thread Starter jpdykeman

    (@jpdykeman)


    Hey Malihu!
    I believe we made it! Thank you for your support and your help, brother!

    Your plugin is awesome!

    Plugin Author malihu

    (@malihu)

    You’re welcome. Glad I helped 🙂

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Strange behavior’ is closed to new replies.