X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   help with j/s for slide show (https://forum.x-cart.com/showthread.php?t=35487)

balinor 11-16-2007 10:03 AM

Re: help with j/s for slide show
 
You have the sizes in the wrong place. Replace this:

new fadeshow(fadeimages, , 400, 267, 1, 3000, 0, "R")

with this:

new fadeshow(fadeimages, 400, 267, 0, 3000, 0, "R")

fotodog13 11-16-2007 10:20 AM

Re: help with j/s for slide show
 
Thanks,

I tried that - to no avail- still not working.
Its driving me crazy.
As is often the case it is probably something really simple.
:?

balinor 11-16-2007 10:21 AM

Re: help with j/s for slide show
 
I'd start over from scratch, as you have probably changed something somewhere that is causing the problem. I use this script all the time, so I know it works. Paste the default code in, change the image names and image size and that is it.

fotodog13 11-16-2007 10:25 AM

Re: help with j/s for slide show
 
Thats a great idea.
Glad to know its not hte script- didn't hink it was but you never know.
Will dump and build see what happens.
Will post back to you,
Thanks for all your time and effort - you make a huge difference to people like me that are trying to get better at this stuff.
Know it takes time but

AYE CARUMBA


Scott V

balinor 11-16-2007 10:30 AM

Re: help with j/s for slide show
 
Yea, I remember fighting with this the first time I tried it as well. Also, while you are at it, to do it right and keep your code clean, save the javascript portion that you put in the head as a separate file - I usually call it slideshow.js. You won't need the literal or <script> part, just what is in between the <script> and </script> Put that file in skin1/. Then in your head of home.tpl, put this:

{if $main eq "catalog" and $current_category.category eq ""}
<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/slideshow.js"></script>{/if}

That only runs the script on the home page, and keeps the code out of the source.

fotodog13 11-16-2007 03:38 PM

Re: help with j/s for slide show
 
Hey Balinor,

Like a dog I have been nawing away on this and finally success- well almost.:smile:

I have gotten the slide to work, but when I try to add the code to the skin1.css
and put the recomended code into the home.tpl
when I look a the slide show in IE I see 2 small missing image icons underneath the slide show images- these missing image icons are hyperlinks that when clicked take me back to either cssdrive.com, or javascriptkits.com

I went back into the dynamic drive script and removed the two references I found for these- near the top of the script where the images for the fade are listed- cleared my cache yet they still show up.

As you know a newbie here, I haven't put j/s into the skin before.
I have tried to reference it a couple of ways thinking that this might be why this problem is happening.

I have put the script in like this

.slideshow.js {

script goes here

}

also tried

slideshow.js {

script here
}

and

#slideshow.js {

script here

}

I have not included <script> </script> or {literal} {/literal} just the code.

Should I be calling for this in some other manner ?

It would be greati f I coud get the js into the skin put at this point I am happy just to get the script working.

any thoughts?

Thanks

Scott V
xcart 4.18

balinor 11-16-2007 06:05 PM

Re: help with j/s for slide show
 
Ummm...don't think you understood my post. You need to create a new .js file called slideshow.js. This is simply a text file. You then upload that file to the skin1/ directory. You don't do anything with skin1.css.

As for the missing images, those are probably from the second image part of the script, you can delete that all together.

jeeya 11-16-2007 06:33 PM

Re: help with j/s for slide show
 
This is old code from dynamic drive. This is all I use and works perfectly in php.

Code:

{literal}
<script language="JavaScript1.2" type="text/javascript">

/***********************************************
* Fade-in image slideshow script- ╘ Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var slideshow_width='500px' //SET IMAGE WIDTH
var slideshow_height='200px' //SET IMAGE HEIGHT
var pause=3000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)

var fadeimages=new Array()
//SET 1) IMAGE PATHS, 2) optional link, 3), optional link target:
fadeimages[0]=["/xcart/skin1/images/1.gif", "url you want link to", "l"]
fadeimages[1]=["/xcart/skin1/images/2.jpg", "url you want link to", ""]
fadeimages[2]=["/xcart/skin1/images/3.jpg", "url you want link to", ""]



////NO need to edit beyond here/////////////

var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p][0]
}

var ie4=document.all
var dom=document.getElementById

if (ie4||dom)
document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div  id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10;visibility: hidden"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0][0]+'">')

var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1

function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/101
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=insertimage(nextimageindex)
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj2.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}

function insertimage(i){
var tempcontainer=fadeimages[i][1]!=""? '<a href="'+fadeimages[i][1]+'" target="'+fadeimages[i][2]+'">' : ""
tempcontainer+='<img src="'+fadeimages[i][0]+'" border="0">'
tempcontainer=fadeimages[i][1]!=""? tempcontainer+'</a>' : tempcontainer
return tempcontainer
}

function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
tempobj.style.visibility="visible"
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex][0]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/101
}

function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML=insertimage(curimageindex)
rotateimage()
}

if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)

</script>
{/literal}


fotodog13 11-17-2007 03:29 AM

Re: help with j/s for slide show
 
DUHHHHH

missed that in the post.
Too many hours looking at the same thing.
Makes much more sense with a fresh set of eyes.

Made txt file and added to skin1/directory.
moving on.


again many thanks

Scott V

fotodog13 11-17-2007 03:33 AM

Re: help with j/s for slide show
 
Raxiitpatel,

THanks for the code
Thisis basically the same scrript I am using,
Being the knuckhead I am with much of thsi stuff I was having probelms getting it to work right.

Think I solved the problems as it is working and moving on to other things.

Thanks again for the reply though.
Scott V


All times are GMT -8. The time now is 12:03 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.