Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Can't get more images to show with this code?

  1. #11
    Join Date
    Oct 2013
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    OK first here are both sites the code is on:

    http://itistheride.boards.net/

    http://www.thescooterprofessor.proboards.com/

    Now I went in and cleaned up the suggested things, changed the AMOUNT to 7 to go with the ARRAY 0f 7. Took out the space at the end of one of the image lines and made the code change as John said and all is well.

    Now one last question John? If I want to add more images in the array just be sure the Amount and array = the same number of images, correct?

    Thanks
    Last edited by jscheuer1; 11-05-2013 at 01:43 PM. Reason: Format

  2. #12
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Yes and no. You can follow that practice and things will work out. But array declaration doesn't have to be so formal, in fact it's better if it's not. Instead of doing (formal array declaration):

    Code:
    var grphcs = new Array(6);
    You can just do (informal array declaration):

    Code:
    var grphcs = [];
    Now it doesn't matter how many images there are in the array as long as there's at least one. The number of images shown at once is what the Amount controls. So if you have only one image and the amount is 10, you will see ten of the same image at a time. If you have 20 images in the array and the amount is still 10, you will see only the first ten.

    This is the same in the more recent code, except with it, each time the page loads the images are shuffled, so if you have more images in the array than set for in the amount property, different ones will be used each time the page loads.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #13
    Join Date
    Oct 2013
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Ok so if I set this code section like this:


    Code:
    var speed=60  // 12 to whatever (60 is pretty slow) higher numbers are slower
    Amount=7; //Smoothness depends on image file size, the smaller the size the more you can use!
    
    //Pre-load your image below!
    var grphcs = [];
    Image0=new Image();
    Image0.src=grphcs[0]="http://www.jr-richscooterdoc.com/HW/skel1.gif ";
    Image1=new Image();
    Image1.src=grphcs[1]="http://www.jr-richscooterdoc.com/HW/skel2.gif"
    Image2=new Image();
    Image2.src=grphcs[2]="http://www.jr-richscooterdoc.com/HW/skel3.gif"
    Image3=new Image();
    Image3.src=grphcs[3]="http://www.jr-richscooterdoc.com/HW/skel4.gif"
    Image4=new Image();
    Image4.src=grphcs[4]="http://www.jr-richscooterdoc.com/HW/skel5.gif"
    Image5=new Image();
    Image5.src=grphcs[5]="http://www.jr-richscooterdoc.com/HW/skel6.gif"
    Image6=new Image();
    Image6.src=grphcs[6]="http://www.jr-richscooterdoc.com/HW/skel7.gif"
    with the informal declaration, 7 images, and the amount at 7 then all 7 images will load each time? But If I set the amount to say 4 then it would grab 4 images and it may reload a different set of 4 each time? If this is the case then one could store many images in their host and then put the link in to match what you want it to grab and control the number of images shown with the "amount number"

    That would be cool.

  4. #14
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    With this code it would just grab the first 4 each time. With the newer code in our other thread it it would grab 4 at random each time the page loads.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #15
    Join Date
    Oct 2013
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I understand Thanks.

  6. #16
    Join Date
    Oct 2013
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    http://itistheride.boards.net/

    http://thescooterprofessor.proboards.com/

    Good Evening John.

    I've got this falling images code on 3 of my forums and I listed two above. I'm having something weird happening. If I out my cursor off the edge of the page on the screen all is well, leaves and banner work at normal speed. But if I put my cursor anywhere on that page with the leaves falling everything goes into slow motion. Is this just me or can you check to see if it does the same for you and help fix it please?

    I just asked another member and it is actually slowing down the forum?

    EDIT: I checked this on IE9 with W7 and IE11 using W8.1 and it seems this is a IE issue. When trying it on Firefox there are no issues at all, leaves fall nicely and the forum isn't slowing down.
    Last edited by JRR; 10-09-2014 at 10:38 AM.

  7. #17
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    There's such a thing as too much animation on a page. With a crawler, a slider and falling leaves, you're getting there - probably already are there for some people. Animation uses clock ticks of CPU time. And often requires memory to hold its motion logic. The browser must mediate with the OS, which in turn is the go between for the hardware itself. If the computer and/or browser/OS combo isn't up to supporting that much animation, things will slow down, particularly if one additional thing is thrown on the heap - like keeping track of a moving cursor.

    I didn't have that problem, but as I started inspecting the page to see more of what was going on, at that point things did bog down.

    I know many people like the leaf thing this time of year, but believe me, on a page that has much information (like yours), it's more of a distraction/annoyance than anything else. I'd get rid of it, especially as it's probably the most intensive animation on those pages, and even if it isn't, it's close, and it's not really contributing much to the page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #18
    Join Date
    Oct 2013
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    All sounds very correct John but if it doesn't have any problems on FF then why IE? This is a old code made back in the time of IE6 and NS6 I believe and the funny thing also is I can use a different version of it with now sway and no issues?

    I don't use this very often, right now the leaves are falling and my members like it. I'll change it to a Halloween theme for a few days around Halloween, same with thanksgiving and Christmas. Even use it for snow too. If need be I'll use the one without the sway but I really like the sway. I was thinking it needed updating to the newer IE format? You updated some yourself:

    Modified by jscheuer1 in http://www.dynamicdrive.com/forums
    * 01/11 for optional direction, allow effect to
    * work fully on wide pages, to not create 'dancing scrollbars' on small
    * pages & use jQuery methods. Requires standards mode DOCTYPE
    * tested in all current version major browsers including IE 8 & IE 9 Beta. */
    /* Updated further 10/13 to allow for stop and start and multiple usage per page, adds preload confirmation before start */

    I don't know how much differences there are between IE8,IE9 and the current one I use IE11? I checked this on my wife's computer with IE9 and it was the same way which for sure says maybe too much as you stated earlier?
    Last edited by JRR; 10-09-2014 at 05:12 PM.

  9. #19
    Join Date
    Oct 2013
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    John I've changed to this oldie code and for the life of me I can't speed it up any? Can you help me with that? It doesn't slow the rest of the forum down.


    Code:
    <script type="text/javascript">
    
    /******************************************
    * Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
    * Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
    * Last updated Nov 9th, 05' by DD. This notice must stay intact for use
    ******************************************/
    
    //Configure below to change URL path to the snow image
    var snowsrc = "http://www.jr-richscooterdoc.com/FLeaf/Leaf1.png";
                    // Configure below to change number of snow to render
                    var no = 48;
    // Configure whether snow should disappear after x seconds (0=never):
    var hidesnowtime = 0;
    // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
    var snowdistance = "pageheight";
    
    
    ///////////Stop Config//////////////////////////////////
    
    var ie4up = (document.all) ? 1 : 0;
    var ns6up = (document.getElementById && !document.all) ? 1 : 0;
    
    function iecompattest() {
                    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
    }
    
    var dx, xp, yp; // coordinate and position variables
    var am, stx, sty; // amplitude and step variables
    var i, doc_width = 800, doc_height = 600;
    
    if (ns6up) {
                    doc_width = self.innerWidth;
                    doc_height = self.innerHeight;
    } else if (ie4up) {
                    doc_width = iecompattest().clientWidth;
                    doc_height = iecompattest().clientHeight;
    }
    
    dx = new Array();
    xp = new Array();
    yp = new Array();
    am = new Array();
    stx = new Array();
    sty = new Array();
    //snowsrc = (snowsrc.indexOf("dynamicdrive.com") != -1) ? "snow.png" : snowsrc
    for (i = 0; i < no; ++i) {
                    dx[i] = 0; // set coordinate variables
                    xp[i] = Math.random() * (doc_width - 50); // set position variables
                    yp[i] = Math.random() * doc_height;
                    am[i] = Math.random() * 20; // set amplitude variables
                    stx[i] = 0.02 + Math.random() / 10; // set step variables
                    sty[i] = 0.7 + Math.random(); // set step variables
                    if (ie4up || ns6up) {
                                    if (i == 0) {
                                                    document.write("<div id=\"dot" + i + "\" style=\"POSITION: absolute; Z-INDEX: " + i + "; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='" + snowsrc.replace(/\d\.(gif|png|jpe?g|bmp)$/i,(Math.round(Math.random()*14+1)+".$1"))
    + "' border=\"0\"><\/a><\/div>");
                                    } else {
                                                    document.write("<div id=\"dot" + i + "\" style=\"POSITION: absolute; Z-INDEX: " + i + "; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='" + snowsrc.replace(/\d\.(gif|png|jpe?g|bmp)$/i,(Math.round(Math.random()*14+1)+".$1"))
    + "' border=\"0\"><\/div>");
                                    }
                    }
    }
    
    function snowIE_NS6() { // IE and NS6 main animation function
                    doc_width = ns6up ? window.innerWidth - 10 : iecompattest().clientWidth - 10;
                    doc_height = $(document).height()
                    for (i = 0; i < no; ++i) { // iterate for every dot
                                    yp[i] += sty[i];
                                    if (yp[i] > doc_height - 60) {
                                                    xp[i] = Math.random() * (doc_width - am[i] - 60);
                                                    yp[i] = 0;
                                                    stx[i] = 0.02 + Math.random() / 10;
                                                    sty[i] = 0.7 + Math.random();
                                    }
                                    dx[i] += stx[i];
                                    document.getElementById("dot" + i).style.top = yp[i] + "px";
                                    document.getElementById("dot" + i).style.left = xp[i] + am[i] * Math.sin(dx[i]) + "px";
                    }
                    snowtimer = setTimeout(snowIE_NS6, 10);
    }
    
    function hidesnow() {
                    if (window.snowtimer)
                                    clearTimeout(snowtimer)
                                    for (i = 0; i < no; i++)
                                                    document.getElementById("dot" + i).style.visibility = "hidden"
    }
    
    if (ie4up || ns6up) {
                    snowIE_NS6();
                    if (hidesnowtime > 0)
                                    setTimeout("hidesnow()", hidesnowtime * 2000)
    }
    
    </script>

Similar Threads

  1. Show/Hide code help
    By wakrah in forum JavaScript
    Replies: 3
    Last Post: 12-22-2009, 04:38 PM
  2. Thumb Pop images On mouse houre images code
    By sreenivasulareddy in forum JavaScript
    Replies: 0
    Last Post: 04-14-2008, 12:30 PM
  3. Flex-Slide Show Images Won't Show
    By stillatlarge in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 09-24-2006, 09:01 PM
  4. having problem with slide show code
    By ashbyfan in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 04-23-2006, 08:30 PM
  5. having problem with slide show code
    By ashbyfan in forum The lounge
    Replies: 1
    Last Post: 04-23-2006, 08:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •