View Full Version : Floating Images


aronuk2000
07-01-2003, 08:07 PM
Hiya

If i use floating images on my page which looks great and im using it as a navigation where all of the images are linked.

I was thinking if it was possible to link the floating images into frames??? If yes, could you show me a script that would do this please???

Thanx A Lot
Aron

P.S - LISSA RULES!!!!

sisqoluv
07-01-2003, 11:36 PM
Originally posted by aronuk2000
Hiya

If i use floating images on my page which looks great and im using it as a navigation where all of the images are linked.

I was thinking if it was possible to link the floating images into frames??? If yes, could you show me a script that would do this please???

Thanx A Lot
Aron

P.S - LISSA RULES!!!!


Are the images already linked? If so, just add target="frame name you want links to open in" after yourpic.jpg".

aronuk2000
07-02-2003, 03:46 PM
this does'nt work!!!

i have tried it and i get a code error popup

sisqoluv
07-02-2003, 09:09 PM
Can I see your code?

aronuk2000
07-03-2003, 03:51 PM
<!-- Beginning of JavaScript -

// CREDITS:
// FlyingPictures by Urs Dudli and Peter Gehrig
// Copyright (c) 2000 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com
// info@24fun.ch
// 8/30/2000

//Provided free at http://www.lissaexplains.com (with permission)

// CONFIGURATION:
// Go to http://www.24fun.com/fast/index.html, open category 'animation' and
// download the ZIP-file of this script containing
// the script-file with step-by-step instructions for easy configuration as well as
// all testimages

// URLs of floating images. Add as many images as you like.
// ATTENTION: Too many images will dlow down the floating effect)
var your_image=new Array()
your_image[0]="buttons/home.gif"
your_image[1]="buttons/fa.gif"
your_image[2]="buttons/info.gif"
your_image[3]="buttons/music.gif"
your_image[4]="buttons/pics.gif"
your_image[5]="buttons/signin.gif"
your_image[6]="buttons/contact.gif"


// You may add links for each image separately.
// In case you do not want to link a picture just add a '#' instead of an URL (see sample below)
var your_image_link=new Array()
your_image_link[0]="http://www.lissaexplains.com"
your_image_link[1]="http://www.lissaexplains.com"
your_image_link[2]="http://www.lissaexplains.com"
your_image_link[3]="#"
your_image_link[4]="http://www.lissaexplains.com"


// average speed of the floating images. Higher means faster
var floatingspeed=5

// do not edit the variables below
var tempo=20
var numberofimages=your_image.length-1
var stepx=new Array()
var stepy=new Array()
for (i=0;i<=numberofimages;i++) {
stepx[i]=randommaker(floatingspeed)
stepy[i]=randommaker(floatingspeed)
}
var imgwidth=new Array()
var imgheight=new Array()
for (i=0;i<=numberofimages;i++) {
imgwidth[i]=10
imgheight[i]=10
}
var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
var timer
var spancontent=new Array()
var imgpreload=new Array()
for (i=0;i<=your_image.length;i++) {
imgpreload[i]=new Image()
imgpreload[i].src=your_image[i]
}

for (i=0;i<=numberofimages;i++) {
spancontent[i]="<a href='"+your_image_link[i]+"'><img src='"+your_image[i]+"' border='0'></a>"
}

function setValues() {
if (document.all) {
marginbottom=document.body.clientHeight-5
marginright=document.body.clientWidth-5
for (i=0;i<=numberofimages;i++) {
var thisspan = eval("document.all.span"+i)
thisspan.innerHTML=spancontent[i]
var thisspan = eval("document.all.span"+(i)+".style")
thisspan.posLeft=randommaker(marginright)
thisspan.posTop=randommaker(marginbottom)
}
for (i=0;i<=numberofimages;i++) {
var thisspan = eval("document.all.span"+i)
imgwidth[i]=thisspan.offsetWidth
imgheight[i]=thisspan.offsetHeight

}
checkmovement()
}
if (document.layers) {
marginbottom=window.innerHeight-5
marginright=window.innerWidth-5
for (i=0;i<=numberofimages;i++) {
var thisspan=eval("document.span"+i+".document")
thisspan.write(spancontent[i])
thisspan.close()
var thisspan=eval("document.span"+i)
thisspan.left=randommaker(marginright)
thisspan.top=randommaker(marginbottom)
}
for (i=0;i<=numberofimages;i++) {
var thisspan=eval("document.span"+i+".document")
imgwidth[i]=thisspan.width
imgheight[i]=thisspan.height
}
checkmovement()
}
}

function randommaker(range) {
rand=Math.floor(range*Math.random())
if (rand==0) {rand=Math.ceil(range/2)}
return rand
}

function checkmovement() {
if (document.all) {
checkposition()
movepictures()
timer=setTimeout("checkmovement()",tempo)
}
if (document.layers) {
checkposition()
movepictures()
timer=setTimeout("checkmovement()",tempo)
}
}

function movepictures() {
if (document.all) {
for (i=0;i<=numberofimages;i++) {
var thisspan=eval("document.all.span"+(i)+".style")
thisspan.posLeft+=stepx[i]
thisspan.posTop+=stepy[i]
}
}
if (document.layers) {
for (i=0;i<=numberofimages;i++) {
var thisspan = eval("document.span"+i)
thisspan.left+=stepx[i]
thisspan.top+=stepy[i]
}
}
}

function checkposition() {
if (document.all) {
for (i=0;i<=numberofimages;i++) {
var thisspan=eval("document.all.span"+i+".style")
if (thisspan.posLeft>marginright-imgwidth[i]) {
thisspan.posLeft-=Math.abs(stepx[i]+1)
stepx[i]=randommaker(floatingspeed)*-1
}
if (thisspan.posLeft<marginleft) {
thisspan.posLeft+=Math.abs(stepx[i])
stepx[i]=randommaker(floatingspeed)
}
if (thisspan.posTop>marginbottom-imgheight[i]) {
thisspan.posTop-=Math.abs(stepy[i])
stepy[i]=randommaker(floatingspeed)*-1

}
if (thisspan.posTop<margintop) {
thisspan.posTop+=Math.abs(stepy[i])
stepy[i]=randommaker(floatingspeed)
}
}
}
if (document.layers) {
for (i=0;i<=numberofimages;i++) {
var thisspan=eval("document.span"+i)
if (thisspan.left>marginright-imgwidth[i]) {
thisspan.left-=Math.abs(stepx[i]+1)
stepx[i]=randommaker(floatingspeed)*-1
}
if (thisspan.left<marginleft) {
thisspan.left+=Math.abs(stepx[i])
stepx[i]=randommaker(floatingspeed)
}
if (thisspan.top>marginbottom-imgheight[i]) {
thisspan.top-=Math.abs(stepy[i])
stepy[i]=randommaker(floatingspeed)*-1

}
if (thisspan.top<margintop) {
thisspan.top+=Math.abs(stepy[i])
stepy[i]=randommaker(floatingspeed)
}
}
}
}

// - End of JavaScript - -->
</script>

<body id="thisbody" bgcolor="#000035" onLoad="setValues()" style="width:100%;overflow-x:hidden;overflow-y:hidden">

<script>
<!-- Beginning of JavaScript -

for (i=0;i<=numberofimages;i++) {
document.write("<span id='span"+i+"' style='position:absolute'></span>")
document.close()
}

// - End of JavaScript - -->

sisqoluv
07-03-2003, 11:38 PM
This might work:

your_image_link[0]="http://www.lissaexplains.com" target="frame name you want it to open in"
your_image_link[1]="http://www.lissaexplains.com" target="frame name you want it to open in"
your_image_link[2]="http://www.lissaexplains.com" target="frame name you want it to open in"
your_image_link[3]="#"
your_image_link[4]="http://www.lissaexplains.com" target="frame name you want it to open in"