Why not to use setTimeout? This way you call once each function, and
forget about clear the interval and waste memory.

function1(){
  // do something...
  // 300000 miliseconds = 5 min -> then i call function2
  window.setTimeout(function2, 300000);
}
function2(){
  // do something
  // 600000 miliseconds = 10 min -> then i call function1 again and
everything keeps in a loop
  window.setTimeout(function1, 600000);
}
// first call
window.setTimeout(function1, 600000);

So, what you think?

On 30 sep, 15:49, Jsudesign <jsudes...@gmail.com> wrote:
> Hello I'm in need of some help in getting my custom ad set up working.
> Any help would be greatly appreciated.
>
> Here's what I'm trying to do: I have content set up and after 10
> minutes I want to display an advertisement over the content that last
> for 5 minutes.
>
> So it would look like this: Regular content: 10 minutes, Ad1 5
> minutes, Regular content 10 minutes, Ad2 5 minutes, Regular content 10
> minutes, Ad3 5 minutes - Then I need it to repeat for ever.
>
> Here's some code I started to write, but It's really not working that
> well for me. Can someone help me out? Thanks a ton, Justin.
>
> <script type="text/javascript">
>
> $(document).ready(function(){
> var interval
> interval = setInterval("getADS()", 1000);// frequency to try repeat.
>
> });
>
>         function getADS(){
>                 $("#ad1").animate({fontSize: "3em"}, 6000); // Last 10 Minutes
> between requests
>                 $("#ad1").fadeIn(3000);
>                 $("#ad1").animate({fontSize: "4em"}, 2400); // Last 5 Minutes
> between requests
>                 $("#ad1").fadeOut(3000);
>
>                 $("#ad2").animate({fontSize: "3em"}, 6000); // Last 10 Minutes
> between requests
>                 $("#ad2").fadeIn(3000);
>                 $("#ad2").animate({fontSize: "4em"}, 2400); // Last 5 Minutes
> between requests
>                 $("#ad2").fadeOut(3000);
>
>                 $("#ad3").animate({fontSize: "3em"}, 6000); // Last 10 Minutes
> between requests
>                 $("#ad3").fadeIn(3000);
>                 $("#ad3").animate({fontSize: "4em"}, 2400); // Last 5 Minutes
> between requests
>                 $("#ad3").fadeOut(3000);
>         }
>
> </script>
>
> <img src="images/ad1.jpg" id="ad1" style="display: none; />
> <img src="images/ad2.jpg" id="ad2" style="display: none; />
> <img src="images/ad3.jpg" id="ad3" style="display: none; />
>
> Any help would be awesome. Thanks!

Reply via email to