0

我想创建这个:http ://tympanus.net/Tutorials/ExpandingImageMenu/

这个演示有一个教程,但它只有水平扩展。如何进行垂直扩展?

4

2 回答 2

1

您在寻找垂直滑动手风琴吗?

垂直滑动手风琴

教程在这里

于 2012-10-08T11:11:17.670 回答
0

请找到下面的代码,它的工作原理与您提供的参考完全一致。

请注意:请在此代码的头部包含来自 jquery.com 的 jquery 库 (CDN) 链接,以使其正常工作。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Horizontal Image Slider</title>

<script type="text/javascript">
    $(document).ready(function(){

        $("ul#hslider li").click(function(){ 

            $(".context").hide("slow");                     //By default all divs are hidden
            $(".curtain").show("slow");                     //Curtains are on

            if($(this).hasClass("active"))
            {   
                $(this).removeClass("active");              //Remove class active       
                $(this).find("span.curtain").show("slow");  //Add Black Curtain
                $(this).find("div.context").hide("slow");   //Hide div content
            }
            else
            {
                $("ul#hslider li").removeClass("active");   //Remove active from all li's
                $(this).addClass("active");                 //Add class active
                $(this).find("span.curtain").hide("slow");  //Remove curtain        
                $(this).find("div.context").show("slow");   //Display div content
            }

            return(false);

        });

    });
</script>   
<style type="text/css">
body                                    { font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0; }
ul#hslider li                           { cursor:pointer; display:inline-block; list-style:none; padding:0; position:relative;vertical-align:top; }
ul#hslider li a img                     { float:left; height:100px; width:100px; }
ul#hslider li span.curtain              {   background:#000; 
                                            display:block; 
                                            height:100px; 
                                            left:0; 
                                            opacity:0.4; 
                                            filter:alpha(opacity=40); /* For IE8 and earlier */ 
                                            top:0; 
                                            position:absolute; 
                                            width:100px;  
                                        }
ul#hslider li .context                  { border:1px dashed #aaa; display:none; float:left; padding:10px; width:260px;  }
ul#hslider li .context p                { background:#eee; padding:5px; text-align:justify; }
</style>

</head>

<body>

<ul id="hslider">

<li>
    <a href="#"><img src="images/mysteryman.jpg" alt="mystery-man" title="MM" /></a>
    <span class="curtain">&nbsp;</span>
    <div class="context">

            <h2>Some Heading - 1</h2>

            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>

            <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

    </div>
</li>

<li>
    <a href="#"><img src="images/mysteryman.jpg" alt="mystery-man" title="MM" /></a>
    <span class="curtain">&nbsp;</span>
    <div class="context">

            <h2>Some Heading - 2</h2>

            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>

            <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

    </div>
</li>

<li>
    <a href="#"><img src="images/mysteryman.jpg" alt="mystery-man" title="MM" /></a>
    <span class="curtain">&nbsp;</span>
    <div class="context">

            <h2>Some Heading - 3</h2>

            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>

            <p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

    </div>
</li>


</ul>

</body>
</html>
于 2012-10-08T13:10:06.663 回答