Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-24-2002, 07:52 PM   PM User | #1
suz
New to the CF scene

 
Join Date: Jul 2002
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
suz is an unknown quantity at this point
Beginner - How to change image size in slideshow

I new at this so I'll try to be as accurate as possible.

I am using a slideshow, but the images that I want to
load are different sizes, and I want to set them individually,
but don't know how. Any help?


<script language="JavaScript1.1">
<!--

//Pixelating Image slideshow
//Copyright Dynamic Drive 2001
//Visit http://www.dynamicdrive.com for this script

//specify interval between slide (in mili seconds)
var slidespeed=3000
//specify images
var slideimages=new Array("photo-1.jpg","photo-2.jpg","photo-3.jpg","photo-4.jpg")
//specify corresponding links
var slidelinks=new Array("http://www.dynamicdrive.com","http://wsabstract.com","http://www.geocities.com")

var imageholder=new Array()
var ie55=window.createPopup
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
window.location=slidelinks[whichlink]
}

//-->
</script>


<a href="javascript:gotoshow()"><img src="photo1.jpg" name="slide" border=0 style="filterrogidXImageTransform.Microsoft.Pixelate(MaxSquare=15,Duration=1)"></a>

<script language="JavaScript1.1">
<!--
var whichlink=0
var whichimage=0
var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie55) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie55) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+pixeldelay)
}
slideit()

//-->
</script>


Thanks,
Suz.
suz is offline   Reply With Quote
Old 07-29-2002, 09:33 PM   PM User | #2
Mrs G
New Coder

 
Join Date: Jul 2002
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Mrs G is an unknown quantity at this point
Try including the WIDTH and HEIGHT attributes in your style statement
Mrs G is offline   Reply With Quote
Old 07-29-2002, 09:48 PM   PM User | #3
Mrs G
New Coder

 
Join Date: Jul 2002
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Mrs G is an unknown quantity at this point
Have a play with the following, this will keep all your images to a size of 100 x 100 just change size to suit.

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<DIV id=divA onfilterchange="" style="position:absolute; left:200; top:50px; width:100; height:100; font-size:35; text-align:center; filter(); border:5 inset blue;cursor:hand" onclick="Pre_Run()">Click Me</DIV>

<SCRIPT language="javascript">
<!--
// see more at www.huntingground.net
newTrans=new Array()
newTrans[newTrans.length] = "progidXImageTransform.Microsoft.Pixelate(maxsquare=10)";

pic=new Array()
pic[pic.length]="photo-1.jpg"
pic[pic.length]="photo-2.jpg"
pic[pic.length]="photo-3.jpg"
pic[pic.length]="photo-4.jpg"

var preloadpics=new Array() // preloads images
for (i=0;i<=pic.length-1;i++) {
preloadpics[i]=new Image()
preloadpics[i].src=pic[i]
}

var tranSpeed = 2.0; // how long transition takes in seconds
var pause = 1000 // in milliseconds
var advance = (tranSpeed*1000)+pause //
var Running = 0;
var i=0
var picnum=0

function Pre_Run(){
Running = 0;
RunMe();
}

function RunMe(){
if (Running == 0){
Running = 1;
divA.style.filter = newTrans[i];
divA.filters[0].apply();
divA.innerHTML = "<img src='"+pic[picnum]+"'width='"+document.all.divA.style.width+"'height='"+document.all.divA.style.height+"'>"

if(i==newTrans.length -1){
i=-1}

if(picnum==pic.length-1){
picnum=-1}

divA.filters[0].play(tranSpeed);
i++
picnum++
}
setTimeout("Pre_Run()",advance)
}
// -->
</SCRIPT>
</BODY></HTML>
Mrs G is offline   Reply With Quote
Old 07-29-2002, 09:53 PM   PM User | #4
Mrs G
New Coder

 
Join Date: Jul 2002
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Mrs G is an unknown quantity at this point
I notice that this forums smiley's interfere with the coding

Where the green smiley is there should

:ID

The line should read

newTrans[newTrans.length] = "progid:DXImageTransform.Microsoft.Pixelate(maxsquare=10)";
Mrs G is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:36 AM.


Advertisement
Log in to turn off these ads.