• Join the Best Wordpress and Elementor Support forum

    Provide or get advice on everything Elementor and Wordpress, ask questions, gain confirmation or just become apart of a friendly, like minded community who love Wordpress and Elementor


    Join us!

link to open accordion not working

  • Thread starter dave.collins1@mohawkcolle
  • Start date
D

dave.collins1@mohawkcolle

New Member
Trying to get a link on Source page to open an accordion on Target page.

The link itself on Source page is straightforward: //mysite.ca/source/#open-moderators

On target page //mysite.ca/target/, this is what I've done:

  1. In the target accordion under CSS ID I have added open-moderators (no # symbol)


  2. Added an HTML widget on the page:
JavaScript:
<script>
jQuery(document).ready(function($) {
    console.log("foo");
  var target = window.location.hash;
  if (target) {
    // Wait for page to load
    setTimeout(function() {
        console.log(target);
      $(target).find('.elementor-tab-title').click();
      $([document.documentElement, document.body]).animate({
        scrollTop: $(target).offset().top - 100 // Adjust -100 for offset
      }, 500);
    }, 400);
  }
});
</script>


When I hit the page //mysite.ca/target/#open-moderators, it does trigger the code:
console.log outputs:
foo
#open-moderators


So the only thing that could be failing is the click itself. Have I borrowed bad code?
 

Latest Resources

Other Elementor Resources

elementor official

Still stuck? Ask the forum

Post your question with a screenshot and a link if you can, and a member will usually reply within a day. Free to join, no sales pitch.

Create a free account
Top