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:
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?
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:
- In the target accordion under CSS ID I have added open-moderators (no # symbol)
- Added an HTML widget on the page:
JavaScript:
<script>
jQuery(document).ready(function($){console.log("foo");
var target = window.location.hash;
if (target){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?
Elementor Services