admin管理员组文章数量:1391981
I have two div
E.g.
<div class="first">
//Div first content
</div>
<div class="second">
//Div second contents
</div>
Initially div second is hidden . I want to show div "second" after loading div "first" with a delay.
I triend $('first').load()
in jquery ,but it is not working.
I am pletely new to jquery,how to do it in an efficient way
I have two div
E.g.
<div class="first">
//Div first content
</div>
<div class="second">
//Div second contents
</div>
Initially div second is hidden . I want to show div "second" after loading div "first" with a delay.
I triend $('first').load()
in jquery ,but it is not working.
I am pletely new to jquery,how to do it in an efficient way
- where is your scripts which tried so far – Azad Commented Nov 14, 2015 at 16:28
- Do you need to show the second after a while, or showing second after the first one is actually loaded? – holden Commented Nov 14, 2015 at 16:36
- Not sure if it was just a typo in when copying it over, but you're missing the period in your class selector. You wrote $('first').load() but it should be $('.first').load() – catch22 Commented Nov 15, 2015 at 17:13
2 Answers
Reset to default 5try this
$(document).ready(function() {
$(".second").delay(2000).fadeIn(500);
});
You can wait for the first div to load before loading the second using either the .ready or .load methods provided by jQuery. Here's a fiddle to see it in action.
.second {
display: none;
}
$('.first').ready(function() {
setTimeout(function() {
$('.second').css("display", "block");
}, 500);
});
本文标签: javascriptshow a div after loading another divStack Overflow
版权声明:本文标题:javascript - show a div after loading another div - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744669257a2618724.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论