We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24495
    • 407 Posts
    Seems to me that the left mark is now more outdented? And the line-height can be 1.3 or 1.4 (it’s a big bold text) without problems.
      • 6573
      • 28 Posts
      Quote from: raum at Jun 23, 2008, 02:12 AM

      @darkmikey:

      yes - I should code a preload-function there. Don´t know how to do it yet.

      I am thinking about using ditto or wayfinder to generate some JS-code (the images are stored as TV) similar to

      <script type="text/javascript">
      pictureArray = new Array("../images/img01.jpg", "../images/img02.jpg", "../images/img03.jpg",  "../images/img04.jpg");
      
      function preloadImages()
      {
        for (i=0; i < pictureArray.length; i++) {
          var Bild = new Image();
          Bild.src = pictureArray[i];
        }
      }
      </script>

      I could even generate this code as a separate dynamic js-file, so it has only to be loaded once ...

      This is just an idea - do you think this is a good solution? do you have better ideas?

      I think that would work, So from how I read it it loads a picture to place it in cache then overwrites the variable that referenced that image with the next image? Sorry but I don’t have a good knowledge of JavaScript its on my to-do list. The only potential problem I can see is if it for some reason removes the previous image in each recursion of the loop from cache and you will need to halt the rest of your script while the preload is taking place
        • 24530
        • 100 Posts
        I have added a preloader ... it seems that I don´t need a separate variable for each image. As far as I understood, the creation process starts to load the image. I even found shorter versions: "new Image().src = pictureArray[i];" without assigning it to a variable!
        ... it seems to work, but maybee someone can help testing?

        what I did:

        new Document
        alias: preload.js
        template: (blank)
        content type: text/javascript
        content:
        function preloadImages()
        {
          var pictureArray = new Array([!Ditto?parents=`[[UltimateParent]]`&depth=`0`&tpl=`js_array`&display=`all` &filter=`hidemenu,0`!] "");
          for (i=0; i < pictureArray.length; i++) {
            Bild = new Image();
            Bild.src = pictureArray[i];
          }                                                               
        }

        (uses Ditto & UltimateParent!)



        new Chunk
        name: js_array
        content:
        [+hintergrundBild:ne=``:then=`"[+hintergrundBild+]", `+]

        (uses PHX!)




        added to template:
        <script type="text/javascript" src="de/preload.js"></script>;
        
        <script type="text/javascript">
        window.addEvent('domready', function(evt){  // I used the mootools "domready" event. could also be called in the body-tag
              ...
              preloadImages();
        }); 
        </script>




        thanks!


        @rasc:
        I will leave the small line-height for the quote – I like this compact style. but thanks a lot!
          my newest webpage [url=http://gitarren.zucali.at]Meisterwerkstatt f
          • 6573
          • 28 Posts
          Seems to work in FF3, Internets going terribly slow though so I’ll give it a better test tomorrow if things improve. Sounds good being able to load the whole array at once.