The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Random picture widget

View previous topic View next topic Go down

Solved Random picture widget

Post by -MiSHmaSH- on September 5th 2013, 9:10 pm

Hi,
Can someone teach me how to make picture widget?
So what I need: Create a widget with pictures, what change random. And if I click on picture, forum direct me to other url. And if it's posible pictures need to change every 10 seconds.

Thanks before.


Last edited by -MiSHmaSH- on September 5th 2013, 9:33 pm; edited 1 time in total

-MiSHmaSH-
Forumember

Male Posts : 267
Reputation : 11
Language : Latvian

Back to top Go down

Solved Re: Random picture widget

Post by levy on September 5th 2013, 9:27 pm

You need to create an new widget :

Widget Name : Whatever
Use a table : No
Widget Title : whatever
Widget Source :

Code:
var images = [],
index = 0;

images[0] = "<a href = 'http://www.computerhope.com/index.htm'><img src='http://www.computerhope.com/banners/banner.gif' alt='Visit Computer Hope'></a>";
images[1] = "<a href = 'http://www.computerhope.com/history/index.htm'><img src='http://www.computerhope.com/banners/banner2.gif' alt='Computer History'></a>";
images[2] = "<a href = 'http://www.computerhope.com/index.htm'><img src='http://www.computerhope.com/banners/banner3.gif' alt='Visit Computer Hope'></a>";
images[3] = "<a href = 'http://www.computerhope.com/newslet.htm'><img src='http://www.computerhope.com/banners/banner4.gif' alt='Computer Hope Newsletter'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);
You need just to replace the link and the img , one more thing : that will automaticaly change only on the page refresh.

levy
Hyperactive

Male Posts : 2566
Reputation : 344
Language : Romanian, English
Location : Romania | Feel free to tag me into your topic if you have a problem

http://help.forumotion.com/

Back to top Go down

Solved Re: Random picture widget

Post by -MiSHmaSH- on September 5th 2013, 9:31 pm

Thanks! You start to scare me. Solved

-MiSHmaSH-
Forumember

Male Posts : 267
Reputation : 11
Language : Latvian

Back to top Go down

Solved Re: Random picture widget

Post by SLGray on September 5th 2013, 11:40 pm

Topic Solved & Locked


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35641
Reputation : 2374
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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