gpt4 book ai didi

javascript - 将变量传递给javascript函数的问题

转载 作者:行者123 更新时间:2023-11-30 18:49:02 26 4
gpt4 key购买 nike

出于某种原因,当我将鼠标悬停在这些对象上时,无论我收到什么错误警报。为什么?

function hoverEffect(listType, button, animatedObject){

var button = $(button), animatedObject = $(animatedObject), listType = $(listType);

if($(listType) == true){

$(button).hover(function(){
alert("listType = true");
$(this).stop(true, true);
$(this).toggleClass("mouseIn", 1000, 'easeOutQuint');
}, function(){
$(this).stop(true, true);
$(this).removeClass("mouseIn", 1000, 'easeOutQuint');
});

}else{

$(button).hover(function(){
alert("listType = false");
$(animatedObject).stop(true, true);
$(animatedObject).toggleClass("mouseIn", 1000, 'easeOutQuint');
}, function(){
$(animatedObject).stop(true, true);
$(animatedObject).removeClass("mouseIn", 1000, 'easeOutQuint');
});

}


}



hoverEffect(false, "#globalNavButton", "#globalNavButton");
hoverEffect(false, "#reelButton", "#reelButton");
hoverEffect(true, ".listHover");

最佳答案

换行

if($(listType) == true){

if($(listType).length > 0){

关于javascript - 将变量传递给javascript函数的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4532383/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com