Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Anyone give me a slide function?

    Hi! Can anyone help me make this spoiler slide open and close instead of just appear and disappear? I'd be really grateful

    Code:
    <html>
    <head>
    <link href="http://fallscountanywhere.com/bbcodes/spoiler.css" rel="stylesheet" type="text/css" media="screen" />
    
    
    <script type="text/javascript">
    function showSpoiler(btn, show)
    {
        var node = btn;
        while ( node.className == null || node.className != "spoiler" )
        {
            node = node.parentNode;
            if ( node == null )
            {
                alert("The html for spoiler is invalid");
                return;
            }
        }
        var inners = node.getElementsByTagName("div");
        inners[0].style.display = show ? "none" : "block";
        inners[1].style.display = show ? "block" : "none";
    }
    </script>
    </head>
    
    <body>
    <div class="spoiler">
        <img src="http://i.imgur.com/6Uq7Y.png" align="right">
        <div class="inner">
            <input type="button" onclick="showSpoiler(this, true);" value="Show" />
        </div>
        <div class="inner" style="display:none;">
            <input type="button" onclick="showSpoiler(this, false);" value="Hide" />
            <div class="text">{param}</div>
        </div>
    </div>
    </body>
    </html>

  • #2


  •  

    Posting Permissions

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