- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我设法将我的 index.html 链接到 jquery,但由于某种原因我的 .slideDown 代码无法正常工作。它有什么问题还是我没有正确附加 jquery?
这是我的 html 代码(包含 .slideDown 的代码):
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TEST</title>
<link rel="shortcut icon" href="../Pictures/Logo.png" />
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
<script src="jquery-2.1.1.min.js"></script>
</head>
<body>
<script>
$("#teamalpha").mouseover(
function(){
$("#teamalpha > div").slideDown(400);
});
</script>
<div id="teamalpha">
<div>
<p>AlphaGuardian</p>
<p>Owner</p>
</div>
</div>
</div>
</body>
</html>
这是我的 CSS 代码(正确链接的样式表):
#teamalpha{
font-family:Optimus;
font-size:24px;
text-align:center;
border:solid;
border-color:#000;
width:250px;
height:250px;
position:relative;
top:100px;
left:200px;
cursor:pointer;
z-index:5;
}
#teamalpha div{
position:relative;
top:-50px;
height:100px;
display:none;
width:250;
background-color:#f7931e;
z-index:6;
}
最佳答案
你的 <script>
需要被包围
// Fire on document ready event
$(document).ready(function(){
// some code here
});
或
// Fire on window load event
$(window).load(function() {
// some code here
});
所以它应该是这样的:
<script>
// Fire on document ready event
$(document).ready(function() {
$("#teamalpha", this).on("mouseover", function() {
$(this).children("div").slideDown(400);
});
});
</script>
或 //触发文档就绪事件 $(窗口).load(函数() { $("#teamalpha", this).on("mouseover", function() { $(this).children("div").slideDown(400); }); });
您的脚本在页面完全加载之前就已运行。现在,它将等到 document
。或 window
完成加载。
关于javascript - .slideDown 对我不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27613730/
A 使用 jquery 设计了一个两级菜单。当我将鼠标悬停在顶部菜单链接时,submenu 类名的 DIV 会向下滑动。当我将鼠标悬停在该 div 内时,会出现一个链接,类名为 subsubmenu
我正在为 Android 手机构建 PhoneGap 应用程序。我使用这样的机制让用户将数据提交到 Web 服务: $('#backdrop').slideDown('fast',function()
我有一个 div#items,如果单击它,则 div#choices slipDown()。如果再次单击,则 div#choices 应该 slipUp();我如何测试选择是否已经下降或上升?我知道我
我是 jquery 新手,我正在尝试在下拉菜单上使用 .slidedown 函数。我希望菜单在单击时打开,并在再次单击选项或菜单时关闭。然而,当按原样单击菜单时,它只是弹开和关闭,而不是保持打开状态。
如何在 css 设置为 display:none 的页面加载时使用 jquery 向下滑动 div?我看到了很多解决方案,但如果 css 设置为 display:none,则没有一个可以滑动 div。
为什么slideDown()第一次不起作用? $('#lnkInfo').click(function (e) { e.preventDefault(); $(this).blur()
我遇到了同样的问题,尽管我找不到解决方案,但我在网上读到了相关内容。 简单地说,当在我的 DIV 元素上使用 SlideDown() 方法时,我得到了丑陋的回弹效果,其中 jQuery 将 DIV 大
我在我的这个网站上使用 JQuery SlideUp 和 SlideDown。 http://ourrecipes.mdssoftware.com.au/ 在 IE 中这工作得很好。但在 Chrome
我的网站上有一个 SlideDown 功能。但不知怎的,当你第一次点击它时它不起作用。所以我需要点击两次才能使该功能起作用。什么可能是错误的? 我还希望当我再次点击按钮时div向上滑动,不知道我将如何
这应该很容易,但我检查了谷歌并没有找到任何相关信息。 我正在做: $notification.slideDown(1000, function(){ $('#n
为什么这个 jQuery 代码不起作用? $(document).ready(function () { $('currentPage').click(function() {
我们什么时候应该使用 jQuery 中的 slideUp/slideDown 以及什么时候使用 slideToggle 函数?slidetoggle 在 IE 中工作是否有问题? 最佳答案 当您想要向
我正在使用 jquery 制作一个向下滑动的菜单。该代码在页面第一次加载时完美运行。但是,slideDown(单击功能的基本部分)对于每个菜单项只能运行一次。这是一个 js fiddle 示例 htt
大家好。我有一点问题。我有一个有序列表,其中包含一系列预先填充的列表项。 Item 1 Item 2 Item 3 Item 4 当我使用 jQuery 动态添加另
我希望有人能帮助我正确完成这项工作。 我有这个 HTML: 1 view modules
我想知道是否有任何方法可以使 SlideDown() 移动看起来更平滑,而无需使用 jQuery UI,只需使用普通的 jquery。 我有这个功能: function optionz(){
我正在尝试构建一个具有动态高度和数量的元素列表,当用户单击它们时,这些元素会上下滑动。问题是,当时只需要显示其中一个,而其他的则在点击后会自动向上滑动。 我遇到了位于正在滑下的元素下方的元素的问题。它
我在 profile.php 中有一个可用的 slideDown div。当我单击用户名时,个人资料信息会向下滑动。这是结构, profile.php - 这工作正常。 $('.showprofile
我目前正在创建一个简单的菜单,其中有多个服务名称,用户可以单击其中一个,jQuery 将在其下方显示相应的描述段落。我的 jQuery 代码很好,完全符合我的要求,但是,我有一个错误尚未解决。 每当我
因此,当与 jQuery slideDown 函数结合使用时,我的渐变会出现令人讨厌的样式现象。 我怀疑正在发生的事情是我在每个页面上都运行了一个全局渐变。在一页上我使用以下内容: function
我是一名优秀的程序员,十分优秀!