Preloader: How to make an element change style during preload

Preloader: How to make an element change style during preload

Hello everybody,

so I got my preloader working and counting up until 100%.

My full preloader.js can be found here:

http://mc-communicate.com/preloader.js

I call the preloader on my front-page.js:

  •  var _pContainer = $('<div id="coll-preloader"></div>')
    1.     var _pPercent = $('<div class="percent">0</div>')
    2. var _pbgwhite = $('<div class="bgwhite"></div>')
    3. var _pbred = $('<div class="bgred"></div>')

    4.     if (!$('.lt-ie9').length) {
    5.         _pContainer.append(_pPercent, _pbgwhite, _pbred);
    6.         $('body.home').append(_pContainer);

    7.         document.addEventListener("collpercent", function () {
    8.             _pPercent.text(Math.round(myPreloader.percentage));
    9.         })

    10.         var myPreloader = new sPreloader({
    11.             contentDiv:'main', //ID of your mainContent
    12.             loaderDiv:'coll-preloader', //ID of your loading DIV
    13.             excludingClass:'no', //Name of class to exclude from the preloader
    14.             logProgress:true, //log the percentage through console.log
    15.             animation:'fade', //animation type: fade | none
    16.             animationSpeed:'1.0' //animation speed

    17.         });

    18.         myPreloader.start();

    But now I want a div to move up while preloading like this:

    if 10% preloaded #bgwhite.css(top:40%) if 20% preloaded #bgwhite.css(top:30%) ... and so on
    Something like: $(function () { $('.percent:contains("5")').each(function () { $('.bgwhite').css("top","49.7%"); });

    Maybe I've sat at this for too long, but does anybody know how to do this?


    Greez,

    LL