我正在尝试在悬停时滑动背景。 我在 HTML 网页中使用了下面的代码一次,它工作正常。 但是当我尝试在我的 ASPX 页面中使用它时,首先它给出了这个错误: “Microsoft JScript 运行时错误:'$' 未声明” 所以我删除了 function() 之前的第一个 $。但我无法让它继续工作。 有什么想法为什么它不起作用吗? 代码是:
<head runat="server">
<title></title>
<script type="text/javascript">
$(function () {
$("#vertical div a").hover(function () {
$("img", this).stop().animate({ top: "-173px" }, { queue: false, duration: 400 });
}, function () {
$("img", this).stop().animate({ top: "0px" }, { queue: false, duration: 400 });
});
});
</script>
<style type="text/css">
.altikisilik
{
display: block;
background: url('Images/Default/Brazil_bg.png') top;
}
#vertical div
{
position: relative;
overflow: hidden;
}
#vertical img
{
position: absolute;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="vertical" class="clear" runat="server">
<div>
<a class="altikisilik" href="Default.aspx">
<img src="Images/Default/Brazil.png" border="0" alt="Brazil" />
</a>
</div>
</div>
</form>
</body>
最佳答案
我看不到代码中任何地方包含 jQuery 脚本。我认为这就是问题所在
关于javascript - Asp.Net&JavaScript : Problem With Image Slide,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6718873/