View Full Version : Ultimate Fade-In without Fade-In

02-28-2007, 04:07 PM
1) Script Title: Ultimate Fade-in Slideshow

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: I am gonig to use this code to display 3 to 5 sets of advertisements on a client's site (thanks for the multiple arrays, linking, and random options in this script). My concern is that I really don't need the fade-in function and am wondering if the script could be cut way down without this option.

Of course I don't know how to do this (I thought I was doing good to be able to get rid of the white background and to set transparent vertical space between the "slideshows"). My ultimate reason for putting the script on a diet is a concern that the script is going to impact search engine randing results and loading time ... perhaps someone will tell me it doesn't matter that there's a long javascript in the head.

I thought that perhaps just putting the head information in an external file (named "homepage.js") and calling it in the head ( <SCRIPT src="homepage.js" type=text/javascript></SCRIPT> ) would help, but then the script didn't work at all.

A. Am I worrying about the length of the script for naught?

B. If it's a valid concern, what part of the code is needed only for the fading?

I've found other scripts that rotate banners, but they don't seem easily adaptable to have 3 to 5 instances of the script on a page OR don't offer individual links to the images OR don't off the choice of RANDOMNESS.

Thanks in advance, Kristi

02-28-2007, 04:22 PM
I wouldn't worry about the length of the script. It can be made external but, it really isn't all that long of a script anyway. Does the fading really bother you? If not, I wouldn't even worry about removing it.

If you do make the script external, make sure to include the credit on the page(s) that use it:

<script src="homepage.js" type=text/javascript>
* Ultimate Fade-In Slideshow (v1.5): Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.

otherwise, you will be violating the DD usage policy.

02-28-2007, 04:39 PM

Thanks for your prompt reply. I had included the credit in the homepage.js. Is that improper?

Why do you think the script no longer worked when I made it external? Do you have to change the way in which you call the script in the body when you link it externally rather than include it in the head?

I wasn't able to copy and past the homepage.js here because I kept getting a posting submission error "You have included 9 images in your message. You are limited to using 4 images so please go back and correct the problem and then continue again. Images include use of smilies, the vB code [img] tag and HTML <img> tags. The use of these is all subject to them being enabled by the administrator."

The fade-in really doesn't bother me. I just was concerned about loading and search engines, as I mentioned.

If you have the time, please let me know what I might be doing wrong with the external file. I basically took the info out of the header, removed the <script type="text/javascript"> and </script> lines and saved it as homepage.js. I then called it in the html file as shown in the prior post.

Sincerely, Kristi

02-28-2007, 07:07 PM
To post long or involved code to the forum, you may need to disable smilies in the editor (advanced editor) and enclose your code in code tags:

code goes here

around your code in the message so that it appears like so when you preview/publish:

code goes here

Code over a certain length isn't allowed. A link to your problem page is as good - often better than posting code.

Here are my general guidelines on external scripts:

Use a text editor to save the script, call it 'file_name.js' where 'file_name' can be any valid file name of your choosing. Substitute the name of your external .js file for some.js in the below:

<script src="some.js" type="text/javascript"></script>

Common problems arise when:

1 ) The script file is not in the directory specified. In the above example it must be in the same directory as the page(s) that use it. Below, it can be in the scripts directory off of the root of a domain:

<script src="http://www.somedomain.com/scripts/some.js" type="text/javascript"></script>

2 ) Opening, closing and/or 'hiding' tags are left in the external file. This means that you must strip:
</script>and any of their many variations from the beginning and end of the external file.

3 ) The external call (<script src="some.js" type="text/javascript"></script>) is not inserted into the page at the correct spot. The external call must be inserted at the same place on the page where the script was/would have been.

4 ) Paths to other files (if) used by the script are no longer valid due to its location. This is only a problem if the external script is kept in a different directory than the page it was working on when it was an internal script. To correct this, use absolute paths inside the script. Absolute path examples:



5 ) Inappropriately combining two or more scripts into one external file. Usually external scripts can be combined if one knows enough about scripting to do so properly. Even then it is possible to overlook something.

A rule of thumb when testing is, if it won't work on the page, it won't work as an external file either.

One other thing, if this is a DD script or any script that requires the credit remain for legal use, include the credit in the on page call, ex:

<script src="some.js" type="text/javascript">
* IFrame SSI script II- Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use

Make sure to retain all the 'decorations', as these include begin and end javascript comment delimiters without which the script won't function.