我有一个循环遍历表中的行的函数,以便在任何给定的时间只显示一行。JavaScript中的暂停功能
我想对此进行扩展,以便当我将鼠标悬停在表上时,它会显示所有行,然后当我移开时,它将一次显示一行。
我遇到的问题是悬停时,第一个函数继续前进,有没有办法'暂停'该函数。我使用ClearInterval()查看了各种示例,但无法将它们与我的脚本相匹配。
//Calling The function that loops through the rows
function hideShow(time)
{
setInterval('showRows()',time);
};
//Set the time between each 'loop' and start looping
$(document).ready(function()
{
hideShow(2000);
}
);
//The hover function to show/hide all the rows
$(document).ready(function()
{
$('#dbTable1 tr').hover(function()
{
$('.Group td').removeClass('RoundBottom');
$('.Group').show();
},
function()
{
$('.Group td').addClass('RoundBottom');
$('.Group').hide();
}
);
}
);
任何人都可以告诉我,我怎么能结合这两个?
干杯,我很亲密,但不是那里。这很好。 – IGGt 2012-07-20 15:32:09