Reputation: 141
Is anyone know how to do this setting?
How can I make a jQuery countdown
I read the post and i tried the code by myself.
But no matter how I change my location. Its finally still go to redirect.php and I want to change the time from 10s to 130s.
I had changed the value as well. But no effect at all.
Any idea?
Thanks.
Upvotes: 4
Views: 13793
Reputation: 260
Use a jQuery countdown plugin such as jCounter that supports custom countdown values and use their fallback setting to do a redirect.
For example, most plugins have a fallback setting which you can make it run
function() { window.open('http://website.com', '_self'); }
Usually used as:
$('.countdownClass').jCounter({
//settings here and the fallback:
fallback: function { window.open('http://website.com', '_self'); }
});
Upvotes: 0
Reputation: 3828
Check out below lines of code:
<p>Counting down to 30 January <span id="year">2010</span>.</p>
<div id="ClsCountdown"></div>
<script type="text/javascript">
$(function () {
var newDay= new Date();
newDay= new Date(newDay.getFullYear() + 1, 1 - 1, 30);
$('#ClsCountdown').countdown({until: newDay});
$('#year').text(newDay.getFullYear());
});
</script>
You can also refer below link:
http://chandreshmaheshwari.wordpress.com/2011/06/20/jquery-countdown-code/
UPDATED: jquery redirect on click or after 10 seconds
This will make helpful for you.
Thanks.
Upvotes: 0
Reputation: 9691
var count = 130;
var countdown = setInterval(function(){
$("p.countdown").html(count + " seconds remaining!");
if (count == 0) {
clearInterval(countdown);
window.open('http://google.com', "_self");
}
count--;
}, 1000);
Upvotes: 16