描述:我正在尝试使用 jquery fadeIn()
我的容器,但它不起作用。我对它有点陌生,刚从 codeacademy jquery 类(class)中毕业。
问题: 我在 myScript.js 文件中编写的方法似乎不起作用。与其他示例相比,语法看起来没问题。我将我的 js 文件链接到 html 文件,如下所示:
<script type="text/javascript" src="/Content/js/myScript.js"></script>
这是我的 index.cshtml 文件,我在其中为某些导航创建了一个容器:
<div class="container" id="fade">
//some other buttons, divs, etc
</div>
这是我包含的自定义 js 文件:
$(document).ready(function () {
$('#fade').fadeIn('slow');
});
最佳答案
如果你想让它淡入,你应该默认隐藏div,否则它已经显示并且淡入不会做任何事情。如果是这种情况,您的 html 应如下所示:
<div class="container" id="fade" style="display: none;">
//some other buttons, divs, etc
</div>
关于javascript - Jquery fadeIn() 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36911417/