Reputation: 852
I'm using a jquery plugin and right now it only runs when the button is click. How can I make it run on page load? Or maybe 3 seconds after page load.
<div class="classysocial"></div>
<script>
$(document).ready(function() {
$(".classysocial").each(function() {
new ClassySocial(this);
});
});
</script>
EDIT: here is the JS for the plugin: http://pastebin.com/Ct6asnYy
Upvotes: 0
Views: 147
Reputation: 8706
I guess Classysocial
is some plugin that binds onclick
event to the button.
If You can't access the plugin code, the hotfix would be to trigger onclick programatically, like:
$("your_button_selector").click()
To achieve delay, take a look at jQuery .delay()
method.
Check also Javascript's native setTimeout
and decide which one suits your needs.
Upvotes: 3