admin管理员组

文章数量:1410717

For example : .html (Click on the Contact button on the right)

I Live to have this function in my website, but I do not want to add a ton of javascript to mit. And so my question is: Is there any simple javascript to do that?

I found a tutorial that just uses CSS3 / here but it shows the panel in the Top of the site, when I want it to the left or right :D

Thanks for your reply

For example : http://www.building58./examples/tabSlideOut.html (Click on the Contact button on the right)

I Live to have this function in my website, but I do not want to add a ton of javascript to mit. And so my question is: Is there any simple javascript to do that?

I found a tutorial that just uses CSS3 http://www.1stwebdesigner./tutorials/slide-out-panel-css3/ here but it shows the panel in the Top of the site, when I want it to the left or right :D

Thanks for your reply

Share Improve this question edited May 28, 2011 at 11:29 Mutation Person 30.5k18 gold badges100 silver badges165 bronze badges asked May 28, 2011 at 11:07 nvcnvnnvcnvn 5,1838 gold badges54 silver badges78 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

i wrote a little example with a sliding panel:

<html>
    <head>
        <script type="text/javascript" >

        </script>

        <style type="text/css">
            #sliding_box {
                position:absolute;
                width:200px;
                height:200px;
                background-color: red;

                top:200px;
                left:0px;               
                -moz-transition: all 1s ease-in-out;
                -webkit-transition: all 1s ease-in-out;
                -o-transition: all 1s ease-in-out;
                transition: all 1s ease-in-out;                 

                margin-left: -190px;            
            }                       

            #sliding_box:hover{

                margin-left: 0px;
            }

        </style>

    </head>

    <body>
        <div id="sliding_box">
            Sliding box
        </div>
    </body>
</html>

Tested it with FF4 and Chrome. You can manipulate the sliding animation with the margin-left parameter.

The thruth is, there is no simple javascript to do that. If you want the popup without any animation, you can write two css styles for 2 different classes and then swich between them with the javascript "onclick" event.

If you want a good looking popup with animation, I would still suggest you use jQuery. It's simple to include the library in your website. And there are tons of plugins for jQuery, that do exactly the thing you want. Of course you can still write your own javascript function to achieve the desired effect, but jQuery was written for that kind of stuff.

本文标签: Javascript Slide Out Panel without JQueryStack Overflow