i'm using http://www.gayadesign.com/scripts/queryloader/
to preload pages. now, works fine home page, when put code on other page, loader stops @ 90% , won't load... i'm using code provided in zip file on site. what's problem? added script initiates plugin
queryloader.selectorpreload = "body"; queryloader.init();
in php file , included in pages... said, works on home page, fails on other. why?
code 1:
var queryloader = { overlay: "", loadbar: "", preloader: "", items: new array(), donestatus: 0, donenow: 0, selectorpreload: "body", ieloadfixtime: 2000, ietimeout: "", init: function() { if (navigator.useragent.match(/msie (\d+(?:\.\d+)+(?:b\d*)?)/) == "msie 6.0,6.0") { return false; } if (queryloader.selectorpreload == "body") { queryloader.spawnloader(); queryloader.getimages(queryloader.selectorpreload); queryloader.createpreloading(); } else { $(document).ready(function() { queryloader.spawnloader(); queryloader.getimages(queryloader.selectorpreload); queryloader.createpreloading(); }); } queryloader.ietimeout = settimeout("queryloader.ieloadfix()", queryloader.ieloadfixtime); }, ieloadfix: function() { var ie = navigator.useragent.match(/msie (\d+(?:\.\d+)+(?:b\d*)?)/); if (ie[0].match("msie")) { while ((100 / queryloader.donestatus) * queryloader.donenow < 100) { queryloader.imgcallback(); } } }, imgcallback: function() { queryloader.donenow ++; queryloader.animateloader(); }, getimages: function(selector) { var = $(selector).find("*:not(script)").each(function() { var url = ""; if ($(this).css("background-image") != "none") { var url = $(this).css("background-image"); } else if (typeof($(this).prop("src")) != "undefined" && $(this).prop("tagname").tolowercase() == "img") { var url = $(this).prop("src"); } url = url.replace("url(\"", ""); url = url.replace("url(", ""); url = url.replace("\")", ""); url = url.replace(")", ""); if (url.length > 0) { queryloader.items.push(url); } }); }, createpreloading: function() { queryloader.preloader = $("<div></div>").appendto(queryloader.selectorpreload); $(queryloader.preloader).css({ height: "0px", width: "0px", overflow:"hidden" }); var length = queryloader.items.length; queryloader.donestatus = length; (var = 0; < length; i++) { var imgload = $("<img></img>"); $(imgload).prop("src", queryloader.items[i]); $(imgload).unbind("load"); $(imgload).bind("load", function() { queryloader.imgcallback(); }); $(imgload).appendto($(queryloader.preloader)); } }, spawnloader: function() { if (queryloader.selectorpreload == "body") { var height = $(window).height(); var width = $(window).width(); var position = "fixed"; } else { var height = $(queryloader.selectorpreload).outerheight(); var width = $(queryloader.selectorpreload).outerwidth(); var position = "absolute"; } var left = $(queryloader.selectorpreload).offset()['left']; var top = $(queryloader.selectorpreload).offset()['top']; queryloader.overlay = $("<div></div>").appendto($(queryloader.selectorpreload)); $(queryloader.overlay).addclass("loadcont"); $(queryloader.overlay).css({ position: position, top: top, left: left, width: width + "px", height: height + "px" }); queryloader.loadbar = $("<div></div>").appendto($(queryloader.overlay)); $(queryloader.loadbar).addclass("loading"); $(queryloader.loadbar).css({ position: "relative", top: "90%", width: "0%" }); }, animateloader: function() { var perc = (100 / queryloader.donestatus) * queryloader.donenow; if (perc > 99) { $(queryloader.loadbar).stop().animate({ width: perc + "%" }, 500, "linear", function() { queryloader.doneload(); }); } else { $(queryloader.loadbar).stop().animate({ width: perc + "%" }, 500, "linear", function() { }); } }, doneload: function() { cleartimeout(queryloader.ietimeout); if (queryloader.selectorpreload == "body") { var height = $(window).height(); } else { var height = $(queryloader.selectorpreload).outerheight(); } //the end animation, adjust likings $(queryloader.loadbar).animate({ height: height + "px", top: 0 }, 500, "linear", function() { $(queryloader.overlay).fadeout(888); $(queryloader.preloader).remove(); }); } }
code 2:
<script> queryloader.selectorpreload = "body"; queryloader.init(); </script>
css:
.loadcont { z-index: 9999 !important; background: #000000; } .loading { height: 1px; background-color: #626262; }
the page is: http://www.okultopedija.com/ulaz?otvori=razno
Comments
Post a Comment