Results 1 to 6 of 6

Thread: externalizing the Translucent Slide Show

  1. #1
    Join Date
    Nov 2006
    Location
    NW Vermont, (New England)
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default externalizing the Translucent Slide Show

    1) Script Title: Translucent Slide Show

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ucentslide.htm

    3) Describe problem: Not a problem -- But I would like to know how (if) this script can be used as an external js file on my web page.

    I quite new and green to using JS, and can't figure out how to do it with this script. I've managed with some others, but not this one.

    If it can be placed in an external file, I need to know how to call it so that the images show in the right location on my page.

    Thanks very much for any help.

    clair

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You would simply put the external script tag in the body where the script would have gone if it wasn't external. Here are my general guidelines (see especially #3):

    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:

    HTML Code:
    <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:

    HTML Code:
    <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:
    Code:
    <script>
    <!--
    and
    Code:
    //-->
    </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:

    Code:
    http://www.somedomain.com/images/button.gif
    
    http://www.somedomain.com/~mysitename/index.html
    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:

    HTML Code:
    <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
    ***********************************************/
    </script>
    Make sure to retain all the 'decorations', as these include begin and end javascript comment delimiters without which the script won't function.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2006
    Location
    NW Vermont, (New England)
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default efforts educational but unsuccessful

    John (aka global moderator) --

    Thank you so much for your extremely informative reply. I have been working on this @#!@#$ thing since I got that reply.

    Here are the results: (no fear - white hat site -- Vermont resort)

    First the original page, which was what I had before I tried using the translucent script:

    original page

    The image in question is the large one in the lower right.

    Here is the page with translucent script inserted directly into the page (enclosed in a styled p):

    http://www.vt2000.com/0-swann/index-ss3.html

    As you can see, it works, but not in the right place (no matter what I tried).

    Here is one of about 45 attempts to externalize the script:

    http://www.vt2000.com/0-swann/index-ss.html

    As you can see, not much success--other than seeing that the script can find everything and that it in fact will operate when inserted directly into the HTML page. The little x image box is sure enough fading! lol

    All files, including the images are in the same directory, and executable permissions are set correctly.

    I did learn much from your reply, and just wanted to let you know that I tried very hard to make it work. Your help did not fall into the void. I am now going to continue my search.

    Thanks very, very much for your generous response.

    Clair

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The external version would show the images if you hadn't added:

    Code:
    images2/
    in two places, thus making the paths to the images invalid.

    Aslo, you need to put the credit on the page as in:

    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:

    HTML Code:
    <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
    ***********************************************/
    </script>
    Make sure to retain all the 'decorations', as these include begin and end javascript comment delimiters without which the script won't function.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Nov 2006
    Location
    NW Vermont, (New England)
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    John --
    Success --

    I could not find the images2/ because I was only looking in the html files. I cannot imagine why I changed that -- unless I've been working on this longer than I thought. That was a ref to an old directory structured before the real site dev. got under way.

    Now everything works and I only get just the warning: unknown property "filter" declaration dropped. (In FF2) but it doesn't seem to hurt anything.

    http://www.vt2000.com/0-swann/index-ss4.html

    And, apparently I needed to use a <div> and not a <p> to get stuff in the right place.

    And of course I would have the credit in there if I ended up using the file -- I've been using boadrink.com's version of formmail for months in many sites and and always give credit --publicly on the page if the client will allow. (I've gone back and put it in there now as this will likely be the last version I work with. (I took it out because I was going through so many changes to try to make this thing work, and leaving it in, increased the chances for stupid cut and paste errors.)

    Anyway, thanks again -- I do appreciate it.

    Cheers,
    Clair
    Last edited by clair; 09-04-2007 at 01:27 PM. Reason: added new information on progress and new url

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Looking good!

    warning: unknown property "filter" declaration dropped
    Is just that, a warning. It refers to a proprietary filter used by IE. FF uses its proprietary style -moz-opacity. The script should however use opacity instead of or in addition to -moz-opacity to be more widely compliant with modern browsers.

    Also, your slide show appears higher on the page in Opera, something you might want to look into.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •