Rotating Banner Issue

Go down

Solved Rotating Banner Issue

Post by itachi uchiha on April 22nd 2017, 2:06 pm

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 April 27th 2017, 8:46 am; edited 1 time in total
avatar
itachi uchiha
Forumember

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

http://www.narutonexusrp.com/forum

Back to top Go down

Solved Re: Rotating Banner Issue

Post by skouliki on April 22nd 2017, 3:25 pm

hello
  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 April 23rd 2017, 8:46 am; edited 1 time in total
avatar
skouliki
Graphic Designer
Graphic Designer

Female Posts : 4119
Reputation : 675
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Rotating Banner Issue

Post by APE on April 22nd 2017, 11:29 pm

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



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Rotating Banner Issue

Post by itachi uchiha on April 23rd 2017, 3:24 pm

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/
avatar
itachi uchiha
Forumember

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

http://www.narutonexusrp.com/forum

Back to top Go down

Solved Re: Rotating Banner Issue

Post by skouliki on April 23rd 2017, 4:18 pm

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
avatar
skouliki
Graphic Designer
Graphic Designer

Female Posts : 4119
Reputation : 675
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Rotating Banner Issue

Post by APE on April 23rd 2017, 6:15 pm

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



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Rotating Banner Issue

Post by itachi uchiha on April 25th 2017, 5:46 pm

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?
avatar
itachi uchiha
Forumember

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

http://www.narutonexusrp.com/forum

Back to top Go down

Solved Re: Rotating Banner Issue

Post by APE on April 25th 2017, 6:03 pm

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)];
        });




avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Rotating Banner Issue

Post by itachi uchiha on April 27th 2017, 8:45 am

It seems to be randomly working now. Thank you for your time.
avatar
itachi uchiha
Forumember

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

http://www.narutonexusrp.com/forum

Back to top Go down

Solved Re: Rotating Banner Issue

Post by APE on April 27th 2017, 12:52 pm

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



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum