jquery - setTimeout function not working correctly -


hey have piece of code fades in whichever div applied to. reason cant work correctly. able make text im wanting fade in on 2s, cannot life of me fade in after 2s have passed (so overall effect should happen once page has loaded after 2s im aiming for. here codepen version different jquery still same problem http://codepen.io/anon/pen/rpjajj

here jquery:

settimeout(function(){     $("#test").fadein(400); }, 5000)// javascript document 

then here id div #test:

/*---------------------------- content ----------------------------*/ #test p {     animation: fadein 2s;     -moz-animation: fadein 2s; /* firefox */     -webkit-animation: fadein 2s; /* safari , chrome */     -o-animation: fadein 2s; /* opera */ } @keyframes fadein {     {         margin-top:-5px;         opacity:0;     }     {         opacity:1;     } } @-moz-keyframes fadein { /* firefox */     {         opacity:0;     }     {         opacity:1;     } } @-webkit-keyframes fadein { /* safari , chrome */     {         opacity:0;     }     {         opacity:1;     } } @-o-keyframes fadein { /* opera */     {         opacity:0;     }     {         opacity: 1;     } } 

and applying html:

===================================================content===================================================!-->     <div class="contentwrap">               <div class="textwrap">         <div id="test">                 <div class="contentspace">                 </div><!--close contentspace!-->                 <div class="content">                                <p class="headertxt">specializations</p>                         <p>with various skills in branding, multi-media                          , advertising able provide fresh , inspiring solutions                          task given me. using various programs such as:</p>                                        <p><img src="images/1436419348_photoshop.png"/><img src="images/1436419350_illustrator.png" /><img src="images/1436419354_dreamweaver.png" /><img src=          "images/1436419357_premiere_pro.png" /><img src="images/1436419359_after_effects.png" /><img src="images/1436419356_flash_pro.png" /></p>               </div><!--close content!-->                 <div class="divider">                         <img src="images/divide.png"/>                 </div><!--close divider!-->                 <div class="content2">                     <p class="headertxt">why me?</p>                     <p>the work create reflecting                     fresh , exciting in order meet clients                      needs. pushing new , innovative ideas                      , pushing end result of brand , product growth</p>                 </div><!--close content2!-->                 <div class="contentspace">                 </div><!--close contentspace!-->             </div><!--close test!-->         </div><!--close textwrap!-->     </div><!--close contentwrap!-->     <!-- 

hope guys able solve mystery of mine! :) shot!

you doing double animations, 1 throught jquery's fadein set run after 5s , run 400ms. , second animation through css animations. since css animation runs 2 second , same thing jquery 1 therefore dont see jquery 1 run.

remove either one, css animation or jquery one.

increase time css 1 2s 5s if use css one.

otherwise removing css provided make jquery animation work.

you can delay css animation using css builtin support delay

http://jsfiddle.net/zlayrwx9/

animation: fadein forwards 2s 4s;

this says use animation named fadein, delay 4s, complete in 2s, , after completion stay in last condition.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -