dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Background Images not Randomizing

Hybrid View

  1. #1
    Join Date
    Jan 2014
    Posts
    2

    Background Images not Randomizing

    I inherited a bit of code and there is one aspect that is driving me bananas, the background images are not randomly loading as they are supposed to. A single static image loads and that's it.

    So I don't bombard anyone with code, the sections that I think are causing the issue are:

    Right after the body tag:

    Code:
    <script type="text/javascript">//<![CDATA[try{(function(a){var b="http://",c="newsite.robertbillings.net",d="/imagebank/cover/",e="img.gif",f=new a;f.src=[b,c,d,e].join("")})(Image)}catch(e){}//]]></script>
    Bottom of page, right before body tag closes:

    Code:
    <!-- Javascripts -->
    
    <script>
    
    var page = "index"; 
    var overlayWidth = 1000;
    
    </script>
    
    
    <script src="../ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    
    <script src="cache/scriptsc058.js?359"></script>
    
    
    
    
    
    <script>
    
    /* JS: Add body class if specific slide is displayed */
    $('img[src$="82_slide_2650.jpg"]').closest('body').addClass('white');
    $('img[src$="82_slide_7069.jpg"]').closest('body').addClass('white');
    $('img[src$="82_slide_5241.jpg"]').closest('body').addClass('white');
    $('img[src$="82_slide_9126.jpg"]').closest('body').addClass('white');
    $('img[src$="82_slide_18089.jpg"]').closest('body').addClass('white');
    
    /* Alternate logo color */
    $('.white header h1 img').prop('src', '../imagebank/cover/82_image_36047.png'); rsn.uniformHeight(666);
    
    // Add download blocker only to home page
    $(document).ready(function() { if (page == "index") { rsn.blocker(); } });
    
    </script>

    Without the lower script nothing loads at all. jquery.min is located on the server. Anyone have an idea?

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,968
    First off, JQuery is not JavaScript.

    Secondly, what is it you want your code to do? It may be simpler to just use JavaScript and its often simper for maintenance and size of script reasons.
    STOP using $ prefix on JavaScript variable names...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles