Metro UI CSS 学习笔记之组件(幻灯片)

符号 阅读:613 2021-03-31 22:43:43 评论:0

查阅Metro UI CSS 对组件(幻灯片)描述,本人觉得已经描述的很详细,所以在这里不打算做详细的讲解,大家可以直接阅读以下源代码(是进过本人已经优化后的代码)。

温馨提示:相关注释,也已经在代码中添加。

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
    <!--metro UI css 样式文件(组件基础)--> 
    <link href="css/metro-bootstrap.css" rel="stylesheet"> 
    <link href="css/metro-bootstrap-responsive.css" rel="stylesheet"> 
    <!--metro UI css 样式文件(组件基础)--> 
    <link href="css/modern.css" rel="stylesheet"> 
    <link href="css/modern-responsive.css" rel="stylesheet"> 
 
    <!--加载jquery js 文件--> 
    <script src="js/jquery/jquery.min.js"></script> 
    <script src="js/jquery/jquery.widget.min.js"></script> 
    <!--加载metro js 文件--> 
    <script src="js/metro/metro.min.js"></script> 
    <!--加载第三方js 文件--> 
    <script src="js/modern/dropdown.js"></script><!--下拉菜单第三方控件--> 
    <script src="js/modern/pagecontrol.js"></script><!--多页控件第三方js--> 
    <script src="js/modern/accordion.js"></script><!--手风琴第三方js--> 
    <script src="js/modern/buttonset.js"></script><!--button第三方js--> 
    <script src="js/modern/rating.js"></script><!--评分第三方js--> 
    <script src="js/modern/carousel.js"></script><!--幻灯片第三方js--> 
    <script src=""></script> 
    <title>Modern UI CSS 学习笔记</title> 
 
 
 
</head> 
<body class="modern-ui" style="background: #f1f1f1"> 
 
<div class="page"> 
    <div class="page-header"> 
        <div class="page-header-content"> 
            <h3>Metro UI CSS样式文件之组件(幻灯片)</h3> 
        </div> 
    </div> 
 
    <div class="page-region"> 
        <div class="page-region-content"> 
            <div class="grid"> 
                <div class="row"> 
                    <div class="span7"> 
                        <div data-param-period="4000" data-param-duration="2000" data-param-direction="left" data-param-effect="slide" data-role="carousel" style="height: 300px;" class="carousel span5"> 
                            <div class="slides"> 
                                <div id="slide1" class="slide image" style="left: -380px;"> 
                                    <img src="./images/1.jpg"> 
                                </div> 
                                <div id="slide2" class="slide image" style="display: block; left: 0px;"> 
                                    <img src="./images/2.jpg"> 
                                </div> 
                                <div id="slide3" class="slide image" style="display: none;"> 
                                    <img src="./images/3.jpg"> 
                                </div> 
                            </div> 
 
 
                            <span class="control left bg-color-blue">‹</span> 
                            <span class="control right bg-color-blue">›</span> 
 
                            <div class="markers"><ul><li class=""><a data-num="0" href="javascript:void(0)"></a></li><li class="active"><a data-num="1" href="javascript:void(0)"></a></li><li><a data-num="2" href="javascript:void(0)"></a></li></ul></div></div> 
                    </div> 
 
                    <div class="span10"> 
                        <div data-param-markers="off" data-param-period="3000" data-param-direction="left" data-param-effect="fade" data-role="carousel" style="height: 300px;" class="carousel span5"> 
                            <div class="slides"> 
                                <div id="slide4" class="slide image" style="display: none;"> 
                                    <img src="./images/1.jpg"> 
                                    <div class="description"> 
                                        Ut egestas tempor magna, sed rutrum felis fermentum quis. Aliquam congue ultricies elit, sit amet tempor tortor tempor nec. 
                                    </div> 
                                </div> 
                                <div id="slide5" class="slide image" style="display: none; left: 0px; top: 0px;"> 
                                    <img src="./images/2.jpg"> 
                                    <div class="description"> 
                                        Ut egestas tempor magna, sed rutrum felis fermentum quis. Aliquam congue ultricies elit, sit amet tempor tortor tempor nec. 
                                    </div> 
                                </div> 
                                <div id="slide6" class="slide image" style="display: block; left: 0px; top: 0px;"> 
                                    <img src="./images/3.jpg"> 
                                    <div class="description"> 
                                        This super beast eats fresh human flesh. She claws picking his nose, uttering at the same contented purring, and tooth picks out of leftover meat. 
                                    </div> 
                                </div> 
                            </div> 
 
 
                            <span class="control left">‹</span> 
                            <span class="control right">›</span> 
 
                        </div> 
                    </div> 
                </div> 
 
                <div class="row"> 
                    <div class="span7"> 
                        <div data-param-markers="off" data-param-period="4000" data-param-duration="300" data-param-direction="left" data-param-effect="switch" data-role="carousel" style="height: 300px;" class="carousel span5"> 
                            <div class="slides"> 
                                <div id="slide7" class="slide image" style="display: none;"> 
                                    <img src="images/1.jpg"> 
                                </div> 
                                <div id="slide8" class="slide image" style="display: block; left: 0px;"> 
                                    <img src="images/2.jpg"> 
                                </div> 
                                <div id="slide9" class="slide image" style="display: none;"> 
                                    <img src="images/3.jpg"> 
                                </div> 
                            </div> 
                        </div> 
                    </div> 
 
                    <div class="span10"> 
                        <div data-param-markers="off" data-param-period="3000" data-param-direction="left" data-param-effect="slowdown" data-role="carousel" style="height: 300px;" class="carousel span5"> 
                            <div class="slides"> 
                                <div id="slide10" class="slide image" style="left: -380px;"> 
                                    <img src="images/1.jpg"> 
                                </div> 
                                <div id="slide11" class="slide image" style="display: block; left: -380px;"> 
                                    <img src="images/2.jpg"> 
                                </div> 
                                <div id="slide12" class="slide image" style="display: block; left: 0px;"> 
                                    <img src="images/3.jpg"> 
                                </div> 
                            </div> 
 
                            <span class="control left bg-color-darken">‹</span> 
                            <span class="control right bg-color-darken">›</span> 
 
                        </div> 
                    </div> 
                </div> 
                <p>你可以手动通过<code>width</code> 和 <code>height</code> 设置幻灯片大小。</p> 
 
                <p> 
                    使用幻灯片,你需要在你页面的<code>head</code>添加<code>carousel.js</code> ,同时在幻灯片对像上添加属性<code>data-role="carousel"</code>。 
                    设置特定的参数,例如:direction, duration, period, 等等。 给幻灯片设置特定的参数,需要使用属性<code>data-param-* </code>给幻灯片对象添加自定义样式。 
                </p> 
 
                <h3>参数:</h3> 
                <ul class="unstyled"> 
                    <li><strong>auto</strong> - 自动播放(默认值: true)</li> 
                    <li><strong>period</strong> - 播放速度 (默认值: 6000)</li> 
                    <li><strong>duration</strong> - 持续时间 (默认值: 1000)</li> 
                    <li><strong>effect</strong> - 动画效果,有效的值: <em>slide, fade, slowdown, switch</em> (默认值: slide)</li> 
                    <li><strong>direction</strong> - 动画方向,有效值: <em>left, right</em> (默认值: left)</li> 
                    <li><strong>markers</strong> - on|off 幻灯片的朦板 (默认值: on)</li> 
                    <li><strong>arrows</strong> - on|off 滑动箭头 (默认值: on)</li> 
                    <li><strong>stop</strong> - on|off 鼠标悬停时动画 (默认值: on)</li> 
                </ul> 
 
 
 
 
 
 
            </div> 
    </div> 
 
</body> 
</html>
效果展示:



标签:CSS
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号