javascript - Best way to fade in fade out a loading css3 animation -
i facing problem loading fade in / out div has css3 based login animation when function loaded. have jsfiddle setup still can not make work. on appreciated!
http://jsfiddle.net/adamchenwei/v4ck6/4/
html
<!doctype html> <body> <div class="loading"> <div class="loading_ball_outside"><div class="loading_inside"></div></div> </div> <div class="section play"> <h1>pload css 2 anywhere--failed</h1> <div class="play_content"> <button class="play_button" id="1">play1</button> <button class="play_button" id="1">play2</button> <button class="play_button" id="1">play3</button> <button class="play_button" id="1">play4</button> <p>something in play ...</p> <div class="play_respond" > <table class="play_respond" width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </div> </div><!--class="play_content" end--> </div><!--class="play" end--> </body> </html>
css
.loading_ball_inside { background-color: rgba(0,0,0,0); border:5px solid rgba(0,183,229,0.9); opacity:.9; border-top:5px solid rgba(0,0,0,0); border-left:5px solid rgba(0,0,0,0); border-radius:50px; box-shadow: 0 0 35px #2187e7; width:50px; height:50px; margin:0 auto; -moz-animation:spin .5s infinite linear; -webkit-animation:spin .5s infinite linear; } .loading_ball_outside { background-color: rgba(0,0,0,0); border:5px solid rgba(0,183,229,0.9); opacity:.9; border-top:5px solid rgba(0,0,0,0); border-left:5px solid rgba(0,0,0,0); border-radius:50px; box-shadow: 0 0 15px #2187e7; width:30px; height:30px; margin:0 auto; position:relative; top:-50px; -moz-animation:spinoff .5s infinite linear; -webkit-animation:spinoff .5s infinite linear; } .loading { position: absolute; /*left: 50%; /*the positioning you're looking for.*/ top: 50%; /* edit these values give you*/ display: none; } @-moz-keyframes spin { 0% { -moz-transform:rotate(0deg); } 100% { -moz-transform:rotate(360deg); } } @-moz-keyframes spinoff { 0% { -moz-transform:rotate(0deg); } 100% { -moz-transform:rotate(-360deg); } } @-webkit-keyframes spin { 0% { -webkit-transform:rotate(0deg); } 100% { -webkit-transform:rotate(360deg); } } @-webkit-keyframes spinoff { 0% { -webkit-transform:rotate(0deg); } 100% { -webkit-transform:rotate(-360deg); } }
jquery
$(document).ready(function(){ //play_pickparentclass beg $(document).on('click','.play_button',function(){ loaderon(); loaderoff(); });//play_pickparentclass end function loaderon(){ ('.loading').fadein('slow'); }; function loaderoff(){ ('.loading').fadeout('slow'); }; });//$(document).ready(function() end
function loaderon(){ $('.loading').fadein('slow'); } function loaderoff(){ $('.loading').fadeout('slow'); }
full code :
$(document).ready(function(){ function loaderon(){ $('.loading').fadein('slow'); } function loaderoff(){ $('.loading').fadeout('slow'); } //play_pickparentclass beg $(".play_button").click( function(){ loaderon(); loaderoff(); });//play_pickparentclass end });//$(document).ready(function() end
demo : http://jsfiddle.net/v4ck6/7/
you can use console check wrong
Comments
Post a Comment