jquery - Call script when site is opened -
how let script start site loaded? want website content have fade in, didn't find event "when site open" yet.
and basically, on site can switch betweent 2 "contents". im far first "content" fadeout on button press, wanted things above done first.
i tried use css animation, there no fade effect, "content" disapears after few seconds. here code want use:
<script> $(document).ready(function(){ $("#button").click(function(){ $("#main").fadeout(200); }); }); </script>
and part of code works fine. so, can me or find solution?
the function defined inside $document.ready()
called when page loads. make sure item trying fade hidden default (display:none
work in css).
to make sure fadeout of first section finished before second section starts fading in, try using settimeout() function. remember set display:none
attribute second section.
$('#main button').click(function(){ $("#main").fadeout(1000); settimeout(function(){ $("#secondary").fadein(1000); }, 1000); }
check out codepen example of together.
Comments
Post a Comment