gpt4 book ai didi

jquery - HoverIntent jQuery 并调用 jQuery 脚本

转载 作者:行者123 更新时间:2023-12-01 08:13:38 24 4
gpt4 key购买 nike

我正在努力将hoverintent jQuery 集成到我的网站中。我已将其插入我的代码中,但我收到来自 Chrome 调试器的错误。错误显示为Uncaught TypeError:无法使用 in 运算符来搜索未定义中的显示。我不确定出了什么问题。这是我的代码。

<script src="http://code.jquery.com/jquery-latest.js"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js">

<script type="text/javascript" src="http://cherne.net/brian/resources

/jquery.hoverIntent.js"></script>

</script>

<script type="text/javascript" >

$(document).ready(function() {

var config = {

sensitivity: 3,
interval: 200,
over: $(this).animate({opacity: 1}, 500),
timeout: 500,
out: $(this).animate({opacity: 0}, 500)

};

var config_1 = {

sensitivity: 3,
interval: 200,
over: $(this).animate({opacity: 1}, 500),
timeout: 500,
out: $(this).animate({opacity: 0}, 500)

};


$('#form1').hoverIntent(config);

$('#form2').hoverIntent(config_1);

});

</script>

这是html代码

<div id="div1">

<form action="" id="form1" method="post">

<textarea id="inputbox1" name="what_i_do" maxlength="160" value=""><?php echo

$profile_data['what_i_do']; ?></textarea>

<input type="submit" id="button1" value="Edit">

</form>

</div>

<div id="div2">

<form action="" id="form2" method="post">

<textarea id="inputbox2" name="fait_accompli" maxlength="160" value=""><?php echo

$profile_data['fait_accompli']; ?></textarea>

<input type="submit" id="button2" value="Edit">

</form>

</div>

最佳答案

这是因为您缺少 document.ready 函数的右大括号和括号

$('#form1').hoverIntent(config);

$('#form2').hoverIntent(config_1);
}); // <----- here to close the document.ready function

更改您的配置以包含 function()

var config = {       
sensitivity: 3,
interval: 200,
over: function(){
$(this).animate({opacity: 1}, 500)
},
timeout: 500,
out: function(){
$(this).animate({opacity: 0}, 500)
}
};

此外,如果两个配置相同,您可以删除其中一个

关于jquery - HoverIntent jQuery 并调用 jQuery 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12062188/

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