TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,946
  • Latest: Sparo
Stats
  • Total Posts: 195,718
  • Total Topics: 21,276
  • Online today: 261
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 79
  • Total: 79

sliding banners

Started by phpshiva, November 12, 2008, 03:55:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

phpshiva

You can put this in a scriptbox
To use for banners or affiliate ads

Demo

<script language="JavaScript1.2">

//you can alter the width here  (in pixels)
var sliderwidth=600
//you can alter the heigt here (in pixels )
var sliderheight=100
//you can alter the seed here (higher is faster)
var slidespeed=4


var leftrightslide=new Array()
var finalslide=''
// alter below your url's (a href ) and the pictures (img scr )
leftrightslide[0]='<a href="http://www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60"  border=0></a>'
leftrightslide[1]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
leftrightslide[2]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
leftrightslide[3]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
///////Dont alter below////////////////////////////////////

var copyspeed=slidespeed

for (i=0;i<leftrightslide.length;i++)
finalslide=finalslide+leftrightslide[i]+"  "


if (document.all){
document.write('<marquee id="ieslider" scrollAmount=0 style="width:'+sliderwidth+'">'+finalslide+'</marquee>')
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=slidespeed")
}

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
document.ns_slider01.visibility="show"
setTimeout("window.onresize=regenerate",450)
intializeleftrightslide()
}
if (document.all)
ieslider.scrollAmount=slidespeed
}

function intializeleftrightslide(){
document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
document. ns_slider01.document.ns_slider02.document.close()
thelength=document.ns_slider01.document.ns_slider02.document.width
scrollslide()
}

function scrollslide(){
if (document.ns_slider01.document.ns_slider02.left>=thelength*(-1)){
document.ns_slider01.document.ns_slider02.left-=slidespeed
setTimeout("scrollslide()",100)
}
else{
document.ns_slider01.document.ns_slider02.left=sliderwidth
scrollslide()
}
}
window.onload=regenerate2

//-->
</script>


<ilayer width=&{sliderwidth}; height=&{sliderheight}; name="ns_slider01" visibility=hide>
<layer name="ns_slider02" onMouseover="slidespeed=0;" onMouseout="slidespeed=copyspeed"></layer>
</ilayer>



this will slide your banners from right to left .
and its easy to put more banner in it

G6Cad

Please repost your code, and this time, in code tags as the code render wrongly with out it.
Also, i will move this to the proper board.

phpshiva

Sorry for that G6

Did the tags now


G6Cad


Bluto

Looks great ! I can't understand the top that is commented out. Doest that part matter?
Or could someone translate?

phpshiva

there is nothing comment out
i translated the code for you

have fun

SmokyBlue



you did a great job, thanks for sharing, phpshiva :D

Bluto

Thank you. Looks very useful.

phpshiva

Your welcom


you can add more banners like this
leftrightslide[4]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
leftrightslide[5]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'



Greetz phpshiva

Bluto

#9
Thanks. I think I will use this for featured affiliates. The ones that deserve the big banners.
Edit: I think I might add an "alt" tag in there to make the spiders happy as well as people with slow connections.

NOBLE CANADIAN

Hello, :)

I tried inputting this code into a scriptbox, but the result is just an empty box. The only code that I edited was the URL specification area.

I'm currently using SMF 1.1.7 and TinyPortal v1.0.5 beta 1.

phpshiva

iff you did it ok than i should show try to look if you left out something in the code
just try to copy code again and alter url again.

NOBLE CANADIAN

Well I gave it another try, but the same result occurs no matter what I do. I have one other scriptbox that's running my Slideshow, which is operating perfectly.

In case you're wondering, I'm using Firefox 3.

phpshiva

do you see the demo on my site? if that is working than yours works to

Bluto

No go here either. I added just 1 url with an image link, I commented out the rest of the links.
The block shows, but there is no height to it. You can see it here on top, above the news box.
http://www.sbmtrader.com/index.php
Edit. I also changed the default image dimensions to fit the size of my image.

SmokyBlue

this is what i am finding on your site phpshiva..

NOBLE CANADIAN

Ok, the problem is that this snippet has a browser incompatibility issue. I just checked it using Internet Explorer 7 and everything seems fine. This snippet won't do much good until it's Firefox 3 friendly as well.

This website is proudly hosted on Crocweb Cloud Website Hosting.