-
-
Save nocodesupplyco/4c9aea28c6a915c141d784a7ae661ff5 to your computer and use it in GitHub Desktop.
Click This to Click That
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Replace .trigger with the class that gets clicked and .recipient with the class that should receive the click. | |
$('.trigger').on('click', function(evt) { | |
setTimeout(function() { | |
$('.recipient').triggerHandler('click'); //element js will click | |
}, 500); //ms of time before action | |
}); | |
//Another related approach with a scroll function that can move content in a parent element with overflow:scroll/auto set. | |
$('.trigger').on('click', function(evt) { | |
setTimeout(function() { | |
$('.recipient').triggerHandler('click'); | |
$('.overflow-scroll').scrollLeft(150); //scroll this element | |
$('html, body').animate({ | |
scrollTop: $("#main").offset().top | |
}, 1000); //anchor link to a specific ID | |
}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment