我试图找到一个显示图像,标题和内容的图片浏览器的教程,因为我想要一个滑块来显示我在数据库中保存的所有文章。 很难找到包含这三个教程的教程。我能找到的所有例子都只显示写在< -img->中的文字。 src标题属性。
<img src="Slider/img/Image1_bum_rgb.jpg" alt="" title="<%#Eval("JobTitle") %>" />
有没有人知道一个例子,教程或可以指向正确方向的东西?真的很感激任何帮助
答案 0 :(得分:1)
Bootstrap有一个非常好的旋转木马,我现在在多个网站上使用过。一切都是可定制的,即放置旋转木马标题等。只有在移动设备上下降时,标题才会隐藏大部分图像,因此需要对其进行定制(参见底部的代码)。以下是从此来源获取的代码:bootstrap carousel
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAGZmZgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAFVVVQAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
在移动设备上修改轮播的代码(CSS):
.carousel-caption .btn{margin-bottom: 10px;}
.carousel-caption { bottom:-213px; margin: -25px; position: relative; background-color:rgba(0,0,0,0);}
.carousel-inner { padding-bottom:205px;}
#myCarousel{margin-bottom: 250px; height:200px;}
#myCarousel img{height: 200px; background:none;}
#myCarousel h2 {padding: 10px;}
显然,根据您选择的图像大小,值会有所不同。
我希望这有帮助,
的问候,
丹
答案 1 :(得分:0)
我知道的最好的事情是使用bootstrap。里面的一切都是开启的,包括幻灯片和动画。 从这个例子中,不需要太多的编码。获取引导程序的所有js和css并复制到您的目录以确保一切运行良好,然后将它们链接到包含幻灯片的网页。
看一下这个样本。
<link rel="stylesheet" href="http://www.appacyber.net/bootstrap.min.css"/>
<div class="row carousel-holder">
<div class="col-md-12">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<h4>Lesson 1</h4>
<img class="slide-image" src="http://www.appacyber.net/_img/software.png" alt=""/>
<h6>Wow I: This is a right place to display your text or article</h6>
</div>
<div class="item">
<h4>Lesson 1</h4>
<img class="slide-image" src="http://www.appacyber.net/_img/hosting.png" alt=""/>
<h6>Wow II: This is a right place to display your text or article</h6>
</div>
<div class="item">
<h4>Lesson 3</h4>
<img class="slide-image" src="http://www.appacyber.net/_img/elektronika.png" alt=""/>
<h6>Wow III: This is a right place to display your text or article</h6>
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
</div>
<script src="http://www.appacyber.net/jquery.min.js"></script>
<script src="http://www.appacyber.net/bootstrap.min.js"></script>