jquery - Load website when progress finishs -


i have created div, name of website. when enter in website, see name getting filled (like progress bar). it's supposed when name completely filled, div dissapears; dissapears when it's not totally filled. more or less in 50%...

can please me?

**you can check out in next link: ** tapehd

here's code...

jquery code

$(document).ready(function () {     /* loading */     $(window).load(function () { $('body').addclass('loading'); });      settimeout(function() {         if($('body').hasclass('loading')) {             $('#loading').fadeout();             $('body').removeclass('loading');             $('body').addclass('loaded');         }     }, 2000);      if($.cookie('showonlyonce')){         $('#loading').hide();     } else {         $.cookie('showonlyonce', 'showonlyonce', { expires: 1 });         $('#loading').show();     }     /* end loading */ }); 

css3 code

body.loading #loading .title2 span, body.loading #loading h1 .progress_bar_container .progress_bar {     width: 100%; }  body.loaded #loading .title2 span, body.loaded #loading h1 .progress_bar_container .progress_bar {     width: 100%; }  #loading {     background-color: #252328;     bottom: 0;     height: 100%;     left: 0;     margin: auto;     max-width: 100%;     position: fixed;     right: 0;     top: 0;     z-index: 999; }  #loading .container {     bottom: 0;     height: 100%;     height: 100%;     left: 0;     margin: 0 auto;     max-width: 100%;     position: absolute;     right: 0;     text-align: center;     top: 0;     width: 29rem; }  #loading h1 {     bottom: 0;     font-family: caviardreams_bold;     font-size: 8.2rem;     height: 1.4em;     left: 0;     margin: auto 0;     position: absolute;     right: 0;     text-align: center;     top: 0; }  #loading h1 span {     display: block;     left: 0;     line-height: normal;     position: absolute;     top: 0; }  #loading h1 .progress_bar_container {     background-color: rgba(0, 0, 0, 0.8);         bottom: 0;     box-shadow: 2px 2px 3px rgba(255,255,255,0.1);     height: 7%;     left: 0;     margin: 0 auto;     position: absolute;     right: 0;     width: 36%; }  #loading h1 .progress_bar_container .progress_bar {     background-color: #fff;     display: inline-block;     height: 100%;     left: 0;     position: absolute;     top: 0;     width: 0%;      -webkit-transition: width 2s linear;        -moz-transition: width 2s linear;         -ms-transition: width 2s linear;          -o-transition: width 2s linear;             transition: width 2s linear; }  #loading .title1 {     color: rgba(0, 0, 0, 0.8);     text-shadow: 2px 2px 3px rgba(255,255,255,0.1); }  #loading .title2 { color: #fff; }  #loading .title2 span {     overflow: hidden;     width: 0%;      -webkit-transition: width 2s linear;        -moz-transition: width 2s linear;         -ms-transition: width 2s linear;          -o-transition: width 2s linear;             transition: width 2s linear; } 

the div has set cookie. it's shown once per day. clean cookies display everytime enter in website...


i have tried animate function

var progress = false;  $(window).load(function () { $('body').addclass('loading'); });  if($('body').hasclass('loading')) { progress = true; }  if(progress == true) {     $("body.loading #loading .tapehdprogress").animate({ width: "100%" }, 2000, function() {         $('#loading').fadeout();         $('body').removeclass('loading');         $('body').addclass('loaded');     }); } 

but doesn't work

hmm first guess current approach unreliable in respect. here's understand you're doing:

  • css configured such loading bar takes 2 seconds fill up.
  • you've set javascript timer fade out loading div after 2 seconds.
  • these 2 processes unrelated each other; you're counting on browser's timing precision them synchronized.

as advanced css trickery, different browsers handle differently can't expect consistent experience. example, in chrome effect appears work fine (the loading screen shows 2 seconds, fades out on cue); in firefox , safari screen doesn't fade out @ (you might want check on that; i'm on osx yosemite.)

if need 2 processes synchronized, i'd use jquery's .animate() allows specify animation , duration, lets specify piece of js code should executed right when animation completes. way you're not relying on 2 separate processes synchronized; completion of loading bar triggers fadeout.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -