0

So I have a function or two that I want to run after my page has been loaded for 10 seconds. Here is the code right now:

            jQuery(document).ready(function() {
            jQuery(".expand-cnt-link").click(function() {
                jQuery(this).toggleClass("ecf_closed").parent(".exp-col-content-holder").find(".hidden-content").first().stop().slideToggle("slow").css("display","inline-block");
                return false;
            }); 
            jQuery(".expand-cnt-link").toggleClass("ecf_closed").parent(".exp-col-content-holder").find(".hidden-content").css("display","none");

Specifically I'm looking for the code that currently is triggered by a click to element ".expand-cnt-link" to be triggered instead by the page having been loaded for 10 seconds.

I've checked out this article: JQuery wait x seconds after document ready

Which seems to suggest that the correct code would be:

            jQuery(document).ready(function() {
            setTimeout(function() {
                jQuery(this).toggleClass("ecf_closed").parent(".exp-col-content-holder").find(".hidden-content").first().stop().slideToggle("slow").css("display","inline-block");
                return false;
            }, 2000);   
            jQuery(".expand-cnt-link").toggleClass("ecf_closed").parent(".exp-col-content-holder").find(".hidden-content").css("display","none");

However that has given me no luck...any suggestions?

Community
  • 1
  • 1
user1709061
  • 95
  • 1
  • 7

1 Answers1

0

Use the code in above block and just call that click function after 10 seconds of page load like this :

setTimeout(function() { jQuery(".expand-cnt-link").click() }, 10000);
Prakash Rao
  • 2,368
  • 1
  • 9
  • 12