0

In my example i want the divs fade in or out the problem is if i add .fadeIn(2000) or .fadeIn(slow) to the elements it doesnt work. How can somebody help me with this

http://jsfiddle.net/slider2nl/aCdRW/3/

var currPage = 'main';
function showPage(id) {
if (currPage !== null) {
    document.getElementById(currPage).style.display = 'none';
}
currPage = id;
document.getElementById(currPage).style.display = 'block';
}

var lastMove = new Date().getTime();
document.onmousemove = function() {
lastMove = new Date().getTime();
}
setInterval(function() {
var now = new Date().getTime();
if (now - lastMove > 10000) {
    showPage('main');
}
}, 1000);
4

1 回答 1

0

我刚刚更新了你的:小提琴

我希望你能看到,主页面会在 2 秒后显示,当你移过顶部的一个链接时,页面就会显示出来。

var currPage = 'main';
function showPage(id) {
    if (currPage !== null) {
        $("#"+currPage).fadeOut(500);
    }
    currPage = id;
    $("#"+currPage).fadeIn(500);
}

var lastMove = new Date().getTime();
document.onmousemove = function() {
    lastMove = new Date().getTime();
}
setInterval(function() {
    var now = new Date().getTime();
    if (now - lastMove > 60000) {
        showPage('main');
    }
}, 1000);

$(document).ready(function () {
$('#main').hide();
$('#main').delay(2000).fadeIn(500);

});
于 2013-06-14T11:15:29.450 回答