Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Animated Collapsible DIV

  1. #1
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Animated Collapsible DIV in Blogger

    1) Script Title: Animated Collapsible DIV

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

    3) Describe problem: when i load my webpage, the <div> is expanded and on clicking the collapse link, the div doesn't collapse.

    ...i am using this script on my Blogger blog and i uploaded the .js to a different domain...

    could this be a problem? i saw this in the .js file:
    window.location.href.replace("http://"+window.location.hostname, "")
    i don't understand what this means yet but i was hopping somebody could tell me if setting up the .js in a different domain can cause the script to not work, so i can then start to 'decode' the .js

    more so, i linked the script's src to the right url here:
    <script type="text/javascript" src="animatedcollapse.js">
    and double checked the entire code. everything is correct in place. the only 'fishy' thing is when i put this piece of code in the blog's <body>:
    <script type="text/javascript">
    var collapse1=new animatedcollapse("dog", 1000, false)
    </script>
    ...i see this after saving:
    <script type='text/javascript'>
    var collapse1=new animatedcollapse(&quot;dog&quot;, 1000, false)
    </script>
    i tried using ' ' instead 0f " " but still i just get the code instead of the symbols

    thanks
    Last edited by ricmetal; 11-14-2007 at 06:04 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The line:

    Code:
    window.location.href.replace("http://"+window.location.hostname, "")
    only deals with persistence of a collapsible DIV's state, and not whether the script works or not when you click on a link to expand/ collapse it. Nothing you mentioned above should be applicable actually.

    One reason why the .js file when uploaded to a different domain doesn't work anymore is if that host has disabled hot linking of .js files, which means the .js file doesn't even load when your calling page is on another domain. This sounds like what's happening here.

  3. #3
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    hey ddadmin!

    thanks f0r the inf0 0n disabling h0tlinks between d0mains.

    ..

    the way this script is set up, if i were t0 put the .js's c0ntent in the <head> secti0n 0f my bl0g, instead 0f having the script targeted t0 an0ther d0main, the script sh0uld w0rk right?

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The key is that the src property of the <script> pointing to the .js file is to a URL on your own domain.

  5. #5
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    n0, i have the src p0inting t0 the right d0main, i just didnt sh0w u which d0main it is in when i p0sted it:

    edited - right n0w its 0n an h0st that accepts h0tlinks

    Code:
    <script type="text/javascript" src="http://www.hotlinkfiles.com/files/570843_ehca9/animatedcollapse.js">
    Last edited by ricmetal; 11-07-2007 at 05:13 PM.

  6. #6
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    edit

    i received a resp0nse fr0m the technical department 0f the h0st im using. they d0nt supp0rt h0tlinking javascripts.

    i f0und an0ther website that all0ws h0tlinking (http://www.hotlinkfiles.com) and i changed the src t0 p0int t0 the file but it still d0esnt w0rk!

    i als0 tried t0 put the c0ntent 0f the .js int0 my bl0gger's html, instead 0f targeting it, and i had n0 luck there either. i just get a bunch 0f xml err0rs.

    im thinking maybe the script needs t0 execute in an 0rder. since i have the expand/c0llapse piece 0f c0de 0n a 'p0st', and n0t 0n the same page as the html, where the javascript c0de is, inside it's <head>, maybe that's what screwing up the c0de...

    als0, bl0gger uses this as a valid d0ctype
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">--><html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
    it has everything the c0de need t0 w0rk, being the 0nly difference in <!-- and -->

    i edited the bl0g with and with0ut the signs and still the c0de remains static, with div expanded when i l0ad the page

    any ideas?
    thanks
    Last edited by ricmetal; 11-07-2007 at 05:11 PM.

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmmm please post a link to the page on your site that contains the problematic script so we can check it out.

  8. #8
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Last edited by ricmetal; 11-07-2007 at 07:42 PM.

  9. #9
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    ive unblocked the blog - sorry bout that if u tried to see it earlier

  10. #10
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The external .js file is loading, but on your HTML page, there are a series of <br> tags inside several SCRIPT tags that's causing errors. For example:

    Code:
    <script type="text/javascript"><br /><br />//Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )<br />var collapse1=new animatedcollapse("dog", 1000, false)<br /><br /></script>
    The above should be edited to something like:

    Code:
    <script type="text/javascript">
    var collapse1=new animatedcollapse("dog", 1000, false)
    </script>
    Do this for all script instances on your page, which there are 3 I believe.

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
  •