Results 1 to 2 of 2

Thread: Animated Collapsible DIV - autoclose in x seconds

  1. #1
    Join Date
    Sep 2007
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Animated Collapsible DIV - autoclose in x seconds

    1) Script Title: Animated Collapsible DIV

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

    3) Describe problem: I would like to set the script to autoclose the div after it has been open for x seconds (or x milliseconds; I'm not picky). I'm not sure what to do -- my java skills are a bit limited. Perhaps someone has already done this and I can't find it on the forum.

    Thanks.

  2. #2
    Join Date
    Sep 2007
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Solved. This code is probably kludgy, but here it is:

    HTML Code:
    <a href="#" onclick="javascript:collapse2.slideit()"><img src="javascript:ImageURL();" border="0" align="top" /></a>
    
    <div id="ad" style="width: 920px; display:none;">
    <img src="http://www.11alive.com/includes/art/ads/pr/ad_gassouth.gif" border="0" align="top" />
    </div>
    
    <script type="text/javascript">
    //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] )
    var collapse2=new animatedcollapse("ad", 800, false)
    function shortInterval()
    {
    self.setTimeout('collapse2.slideit()', 3000);
    }
    shortInterval();	
    </script>
    <script type="text/javascript">
    function longInterval()
    {
    self.setTimeout('collapse2.slideit()', 13000);
    }
    longInterval();
    </script>
    That will make the div appear after 3 seconds, then close up after about 10 more.

    Suggestions for refinement welcome. I'm NOT a java programmer.

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
  •