zfade立即触发 - 任何想法我做错了什么?
$('.country_holder').hover(
function(zfade) {
$('.gallery_img').css('z-index','999');
},
function() {
$('.gallery_img').css('z-index','99');
});
setTimeout(zfade, 10000);
编辑以包含CSS / html。
Jsfiddle简写:https://jsfiddle.net/5Lkz4sef/
Jsfiddle longhand:https://jsfiddle.net/5Lkz4sef/2/
答案 0 :(得分:2)
您需要在使用之前定义该功能
var zfadeIn = function() {
$('.gallery_img').css('z-index','999');
};
var zfadeOut = function() {
$('.gallery_img').css('z-index','99');
};
$('.country_holder').hover(zfadeIn,zfadeOut);
setTimeout(zfadeIn, 10000);