Note that there are some explanatory texts on larger screens.

plurals
  1. POTypeError using QueryLoader plugin
    primarykey
    data
    text
    <p>For page loader i have used the plugin. Following is js:</p> <pre><code>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") { //break if IE6 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(); }); } //help IE drown if it is trying to die :) 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 &lt; 100) { QueryLoader.imgCallback(); } } }, imgCallback: function() { QueryLoader.doneNow ++; QueryLoader.animateLoader(); }, getImages: function(selector) { var everything = $(selector).find("*:not(script)").each(function() { var url = ""; if ($(this).css("background-image") != "none") { var url = $(this).css("background-image"); } else if (typeof($(this).attr("src")) != "undefined" &amp;&amp; $(this).attr("tagName").toLowerCase() == "img") { var url = $(this).attr("src"); } url = url.replace("url(\"", ""); url = url.replace("url(", ""); url = url.replace("\")", ""); url = url.replace(")", ""); if (url.length &gt; 0) { QueryLoader.items.push(url); } }); }, createPreloading: function() { QueryLoader.preloader = $("&lt;div&gt;&lt;/div&gt;").appendTo(QueryLoader.selectorPreload); $(QueryLoader.preloader).css({ height: "0px", width: "0px", overflow: "hidden" }); var length = QueryLoader.items.length; QueryLoader.doneStatus = length; for (var i = 0; i &lt; length; i++) { var imgLoad = $("&lt;img&gt;&lt;/img&gt;"); $(imgLoad).attr("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 = $("&lt;div&gt;&lt;/div&gt;").appendTo($(QueryLoader.selectorPreload)); $(QueryLoader.overlay).addClass("QOverlay"); $(QueryLoader.overlay).css({ position: position, top: top, left: left, width: width + "px", height: height + "px" }); QueryLoader.loadBar = $("&lt;div&gt;&lt;/div&gt;").appendTo($(QueryLoader.overlay)); $(QueryLoader.loadBar).addClass("QLoader"); $(QueryLoader.loadBar).css({ position: "relative", top: "50%", width: "0%" }); }, animateLoader: function() { var perc = (100 / QueryLoader.doneStatus) * QueryLoader.doneNow; if (perc &gt; 99) { $(QueryLoader.loadBar).stop().animate({ width: perc + "%" }, 500, "linear", function() { QueryLoader.doneLoad(); }); } else { $(QueryLoader.loadBar).stop().animate({ width: perc + "%" }, 500, "linear", function() { }); } }, doneLoad: function() { //prevent IE from calling the fix clearTimeout(QueryLoader.ieTimeout); //determine the height of the preloader for the effect if (QueryLoader.selectorPreload == "body") { var height = $(window).height(); } else { var height = $(QueryLoader.selectorPreload).outerHeight(); } //The end animation, adjust to your likings $(QueryLoader.loadBar).animate({ height: height + "px", top: 0 }, 500, "linear", function() { $(QueryLoader.overlay).fadeOut(800); $(QueryLoader.preloader).remove(); }); } } </code></pre> <p>In my html file, I used following Javascript:</p> <pre><code>&lt;script type='text/javascript'&gt; QueryLoader.init(); &lt;/script&gt; </code></pre> <p>And css is as following:</p> <pre><code>.QOverlay { background-color: #000000; z-index: 9999; } .QLoader { background-color: #CCCCCC; height: 1px; } </code></pre> <p>I used this for simple example it works well. But when I used this for my site it is giving error in js file as following:</p> <blockquote> <p>TypeError: $(...).offset(...) is undefined</p> </blockquote> <pre><code>var left = $(QueryLoader.selectorPreload).offset()['left']; </code></pre> <p>So please can you help out from this issue: Thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload