Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spoilers?
#1
I'm learning the basics of HTML and PHP and I was wondering if there is a way to make spoilers work in HTML or PHP. I looked it up, and everything that people said to do wouldn't work for me.
[Image: b7yj2x.png]
Reply
#2
Do you want spoilers for a forum or a website?

Basically it's a hidden div for the xhtml and the php would probably be a preg_replace.
Superman I am here to rescue you.
This is Support Forums not Support PMs.  Do not PM me for support unless it's private and site related.
Reply
#3
(04-27-2010, 10:32 PM)Omniscient Wrote: Do you want spoilers for a forum or a website?

Basically it's a hidden div for the xhtml and the php would probably be a preg_replace.

I want to use spoilers on a website. So the div is hidden from the source then?
[Image: b7yj2x.png]
Reply
#4
I made one in my site. It's using a div thing. An easy way to find the source for one is add a spoiler to your post, then get the source code from that page, and Ctrl+F Spoiler or the contents of your spoiler. (That's how I did it)
zzzzzzz
Reply
#5
(04-27-2010, 11:36 PM)daneasaur Wrote: I made one in my site. It's using a div thing. An easy way to find the source for one is add a spoiler to your post, then get the source code from that page, and Ctrl+F Spoiler or the contents of your spoiler. (That's how I did it)

Thank you Daneasaur. By the way, were you able to use multiple spoilers? I heard that if it's done you can only use one per page, or something like that.
[Image: b7yj2x.png]
Reply
#6
You can use two, I remember I had to google to figure out how, but it wasn't anything hard. Something simple like not using two in the same dev or something.
zzzzzzz
Reply
#7
Google a little.

http://www.msghelp.net/showthread.php?tid=56365&page=2
Reply
#8
Look at this:

In the tag <head> and </head>
Code:
<script type="text/javascript">
function Suite(lien){
    
    var objet = document.getElementById('popup'); // In the ' you put the name of the div you want to hide
    
    if(objet.style.display == "none" || !objet.style.display){
        
        objet.innerHTML = "Text to show";
        objet.style.display = "block";
        objet.style.overflow = "hidden";
        lien.innerHTML = "-";
      
        var hFinal      =     200;  //Final Height
        var hActuel     =     0;         //Initial Height
      
        var timer;
        var fct =        function ()
        {
                hActuel  +=       20;     //Height
                
                objet.style.height     =     hActuel      +     'px';
                
                if( hActuel > hFinal)
                {
                        clearInterval(timer);   //We stop the timer
                        objet.style.overflow    =   'inherit';
                }
        };
        fct();

        
        timer = setInterval(fct,40);    //Every 40 ms
        
    }else if(objet.style.display == "block"){
        
        var hFinal      =     0;  //Final Height
        var hActuel     =     200;         //Initial Height
      
        var timer;
        var fct =        function ()
        {
                hActuel  -=   20;     //Height
                
                objet.style.height     =     hActuel      +     'px';
                
                if( hActuel < hFinal)
                {
                        clearInterval(timer);   //We stop the timer
                        objet.style.overflow    =   'inherit';
                        objet.style.display     =   "none";
                }
        };
        fct();

        
        timer = setInterval(fct,40);    //Every 40 ms
        

        lien.innerHTML = "+";
        
    }
}
</script>

In the tag <body> and </body>:
Code:
[<a href="javascript:;" onclick="Suite(this)">+</a>]

<div id="popup" style="display: none; border: #000000 1px solid; width: 300px;">

</div>

<br /><br />Here :)

I hope it help you
Reply
#9
Thanks for your help guys. I finally got it. Smile
[Image: b7yj2x.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)