有人能帮我解决这个问题吗?
这是我现在拥有的 http://jsfiddle.net/fergu0516/GAVDA/
var leave = 200;
if(leave > 0)
{
CounterTimer();
}
function CounterTimer()
{
var minute = Math.floor(leave / 60);
var second = Math.floor(leave) - (minute*60);
minute=minute<10 ? "0" + minute : minute;
second=second<10 ? "0" + second : second;
var remain = minute + ":" + second;
leave = leave-1 ;
document.getElementById("clkTimer").innerHTML = remain;
if(leave >= 0)
{
setTimeout(CounterTimer,1000);
}
else
{
alert("Your cart is expired!")
window.location = "#";
}
}
$(document).ready(function(){
// The relative URL of the submit.php script.
// You will probably have to change it.
// Caching the feedback object:
var feedback = $('#feedback');
$('#feedback').click(function(){
// We are storing the values of the animated
// properties in a separate object:
var anim = {
mb : 207, // Margin Bottom
pt : 0 // Padding Top
};
var el = $(this).find('.arrow');
if(el.hasClass('buttonright')){
anim = {
mb : 0,
pt : 0
};
}
// The first animation moves the form up or down, and the second one
// moves the "Feedback heading" so it fits in the minimized version
feedback.stop().animate({marginRight: anim.mb});
feedback.find('.section').stop().animate({paddingTop:anim.pt},function(){
el.toggleClass('buttonright buttonleft');
});
});
});
我需要具有与示例相同的效果:现在发生的情况是,当我按下红色框时,计时器会通过为 (div id="feedback") 提供 207px 的边距来显示。
我需要的是当时间达到 1:00 时自动发生这种情况。因此,当计时器达到 1:00 时,窗口将显示,通过将 margin-right:207px 添加到对象。
非常感谢,任何事情都会有所帮助。