The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    Rotating Banner Issue

    itachi uchiha
    itachi uchiha
    Forumember


    Male Posts : 136
    Reputation : 1
    Language : English
    Location : New Zealand

    Solved Rotating Banner Issue

    Post by itachi uchiha Sat 22 Apr - 14:06

    Hello so recently, as of yesterday. I used to run a rotating banner that changes every time the page refreshes. I followed the guide you made here on forumotion and then suddenly it just stopped working? I have the code here and everytime I try and do it now, the banner doesn't show at all and just loads nothing. Here is the code.

    Code:
    $(function() {
      var banners = [
        'http://i38.servimg.com/u/f38/18/21/60/73/b010.png',
        'http://orig11.deviantart.net/ada6/f/2017/094/7/d/nn_by_satoace-db4mn24.png',
     
     
      logo = document.getElementById('i_logo') || document.getElementById('logo') || document.getElementById('pun-logo');
      if (logo) (logo.tagName == 'IMG' ? logo : logo.firstChild).src = banners[Math.floor(Math.random() * banners.length)];
    });


    Last edited by itachi uchiha on Thu 27 Apr - 8:46; edited 1 time in total
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15312
    Reputation : 1705
    Language : English,Greek
    Location : Greece

    Solved Re: Rotating Banner Issue

    Post by skouliki Sat 22 Apr - 15:25

    hello
    Rotating Banner Issue B010  I see this as the first image ..is this your banner ?

    If not then this image url is broken https://i.servimg.com/u/f38/18/21/60/73/b010.png
    Try to reload the banner ( if you have saved it , from your personal files ) and insert into the code the new url

    I suggest you save all your images to be sure


    Last edited by skouliki on Sun 23 Apr - 8:46; edited 1 time in total

    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19327
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Rotating Banner Issue

    Post by Ape Sat 22 Apr - 23:29

    Please can you post your forum url to the forum you are having the problem.



    Rotating Banner Issue Left1212Rotating Banner Issue Center11Rotating Banner Issue Right112
    Rotating Banner Issue Ape_b110
    Rotating Banner Issue Ape1010
    itachi uchiha
    itachi uchiha
    Forumember


    Male Posts : 136
    Reputation : 1
    Language : English
    Location : New Zealand

    Solved Re: Rotating Banner Issue

    Post by itachi uchiha Sun 23 Apr - 15:24

    At the moment I have the javascript turned off because it removes my entire banner but no that is not the 2 banners. The second banner is this one ( https://i.servimg.com/u/f58/18/76/17/65/nn210.jpg ).


    Site Link: http://www.narutonexus.com/
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15312
    Reputation : 1705
    Language : English,Greek
    Location : Greece

    Solved Re: Rotating Banner Issue

    Post by skouliki Sun 23 Apr - 16:18

    The http.....png urls with green color at the begging of your code are the banners you want to appear ..correct the urls and retry the code 

    Now the code you provide above has the wrong urls

    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19327
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Rotating Banner Issue

    Post by Ape Sun 23 Apr - 18:15

    Hello looking at your code there is lots of problems with missing codes
    you need to re install it using this
    https://help.forumotion.com/t138806-randomize-your-forum-banner

    if you look at your code you have things missing



    Rotating Banner Issue Left1212Rotating Banner Issue Center11Rotating Banner Issue Right112
    Rotating Banner Issue Ape_b110
    Rotating Banner Issue Ape1010
    itachi uchiha
    itachi uchiha
    Forumember


    Male Posts : 136
    Reputation : 1
    Language : English
    Location : New Zealand

    Solved Re: Rotating Banner Issue

    Post by itachi uchiha Tue 25 Apr - 17:46

    There is nothing missing with the codes. They are the exact same. The only thing different is I am using 2 banners and that code is using 6 hence why they have more urls than me. There is nothing wrong with my code, it just stopped working randomly on forumotions just like a lot of my other javascripts on my site?
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19327
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Rotating Banner Issue

    Post by Ape Tue 25 Apr - 18:03

    yes i see the problem you do have parts missing look at your code here
           
    Code:
    $(function() {


     Â         var banners = [

     Â           'http://i38.servimg.com/u/f38/18/21/60/73/b010.png',
     Â           'http://orig11.deviantart.net/ada6/f/2017/094/7/d/nn_by_satoace-db4mn24.png'

     Â         logo = document.getElementById('i_logo') || document.getElementById('logo') || document.getElementById('pun-logo');


     Â         if (logo) (logo.tagName == 'IMG' ? logo : logo.firstChild).src = banners[Math.floor(Math.random() * banners.length)];


     Â       });

    see your code is all ok until you get under your URL's
    then you have this part missing

    Code:
    ],
      if you look your code should be something like this


    Code:
     $(function() {
              var banners = [
                'http://i38.servimg.com/u/f38/18/21/60/73/b010.png',
        'http://orig11.deviantart.net/ada6/f/2017/094/7/d/nn_by_satoace-db4mn24.png'
              ],
           
              logo = document.getElementById('i_logo') || document.getElementById('logo') || document.getElementById('pun-logo');
              if (logo) (logo.tagName == 'IMG' ? logo : logo.firstChild).src = banners[Math.floor(Math.random() * banners.length)];
            });




    Rotating Banner Issue Left1212Rotating Banner Issue Center11Rotating Banner Issue Right112
    Rotating Banner Issue Ape_b110
    Rotating Banner Issue Ape1010
    itachi uchiha
    itachi uchiha
    Forumember


    Male Posts : 136
    Reputation : 1
    Language : English
    Location : New Zealand

    Solved Re: Rotating Banner Issue

    Post by itachi uchiha Thu 27 Apr - 8:45

    It seems to be randomly working now. Thank you for your time.
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19327
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Rotating Banner Issue

    Post by Ape Thu 27 Apr - 12:52

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    Rotating Banner Issue Left1212Rotating Banner Issue Center11Rotating Banner Issue Right112
    Rotating Banner Issue Ape_b110
    Rotating Banner Issue Ape1010

      Current date/time is Mon 23 Sep - 17:30