基于Bootstrap框架實(shí)現(xiàn)圖片切換
準(zhǔn)備圖片,把相關(guān)記錄添加至數(shù)據(jù)庫(kù)表中:
創(chuàng)建一個(gè)存儲(chǔ)過(guò)程,獲取所有記錄:
在ASP.NET MVC專案中,部署B(yǎng)ootstrap環(huán)境......
然后創(chuàng)建一個(gè)model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Insus.NET.Models
{
public class Slider
{
public byte Slider_nbr { get; set; }
public byte Sequence { get; set; }
public string Title { get; set; }
public string ImageUrl { get; set; }
public string Description { get; set; }
}
}
再創(chuàng)建一個(gè)Entity:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Insus.NET.Models;
using System.Data;
using Insus.NET.ExtendMethods;
using Insus.NET.DataBases;
namespace Insus.NET.Entities
{
public class SliderEntity
{
BizSP sp = new BizSP();
public IEnumerable<Slider> Sliders()
{
sp.ConnectionString = DB.ConnectionString;
sp.Parameters = null;
sp.ProcedureName = "usp_Slider_GetAll";
DataTable dt = sp.ExecuteDataSet().Tables[0];
return dt.ToList<Slider>();
}
}
}
設(shè)置圖片切換速度:
View視圖:
<div class="tp-wrapper">
<div id="imgcarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
@foreach (var item in (new SliderEntity()).Sliders())
{
<li data-target="#imgcarousel" data-slide-to="@item.Sequence" class="@(item.Sequence == 0 ? "active" : "")"></li>
}
</ol>
<div class="carousel-inner">
@foreach (var item in (new SliderEntity()).Sliders())
{
<div class="@(item.Sequence == 0 ? "item active" : "item")">
<img src="~/Content/img/slider-images/@item.ImageUrl"
alt="@item.Description" class="img-responsive" />
<div class="carousel-caption">
<h1>@item.Title</h1>
<p>@item.Description</p>
</div>
</div>
}
</div>
<a class="left carousel-control" href="#imgcarousel" rel="external nofollow" rel="external nofollow" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#imgcarousel" rel="external nofollow" rel="external nofollow" data-slide="next">
<span class="icon-next"></span>
</a>
</div>
</div>
演示:
以上所述是小編給大家介紹的基于Bootstrap框架實(shí)現(xiàn)圖片切換,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- Bootstrap標(biāo)簽頁(yè)(Tab)插件使用方法
- 簡(jiǎn)單實(shí)現(xiàn)Bootstrap標(biāo)簽頁(yè)
- BootStrap框架個(gè)人總結(jié)(bootstrap框架、導(dǎo)航條、下拉菜單、輪播廣告carousel、柵格系統(tǒng)布局、標(biāo)簽頁(yè)tabs、模態(tài)框、菜單定位)
- Bootstrap每天必學(xué)之標(biāo)簽頁(yè)(Tab)插件
- 使用BootStrap實(shí)現(xiàn)標(biāo)簽切換原理解析
- Bootstrap的Carousel配合dropload.js實(shí)現(xiàn)移動(dòng)端滑動(dòng)切換圖片
- Bootstrap基本插件學(xué)習(xí)筆記之標(biāo)簽切換(17)
- Bootstrap選項(xiàng)卡動(dòng)態(tài)切換效果
- Bootstrap 最常用的JS插件系列總結(jié)(圖片輪播、標(biāo)簽切換等)
- 很棒的Bootstrap選項(xiàng)卡切換效果
- BootStrap中Tab頁(yè)簽切換實(shí)例代碼
- 基于Bootstrap實(shí)現(xiàn)tab標(biāo)簽切換效果
- Bootstrap實(shí)現(xiàn)的標(biāo)簽頁(yè)內(nèi)容切換顯示效果示例
相關(guān)文章
javascript實(shí)現(xiàn)全局匹配并替換的方法
這篇文章主要介紹了javascript實(shí)現(xiàn)全局匹配并替換的方法的總結(jié),十分的簡(jiǎn)單實(shí)用,有需要的小伙伴可以參考下。2015-04-04
java和javascript獲取word文檔的書簽位置對(duì)比
這篇文章主要介紹了java和javascript獲取word文檔的書簽位置代碼對(duì)比,需要的朋友可以參考下2014-06-06
使用JS和canvas實(shí)現(xiàn)gif動(dòng)圖的停止和播放代碼
這篇文章主要介紹了使用JS和canvas實(shí)現(xiàn)gif動(dòng)圖的停止和播放代碼,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-09-09
js 獲取瀏覽器版本以此來(lái)調(diào)整CSS的樣式
判斷當(dāng)前使用的是那個(gè)瀏覽器及瀏覽器的那個(gè)版本,根據(jù)瀏覽器版本來(lái)調(diào)整CSS的樣式,下面是獲取當(dāng)前瀏覽器的代碼,需要的朋友可以參考下2014-06-06
在JavaScript中實(shí)現(xiàn)鏈?zhǔn)秸{(diào)用的實(shí)現(xiàn)
這篇文章主要介紹了在JavaScript中實(shí)現(xiàn)鏈?zhǔn)秸{(diào)用的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-12-12
JavaScript Spread Syntax (...)的十種使用方法
這篇文章主要介紹了JavaScript Spread Syntax (...)的十個(gè)強(qiáng)大用途,擴(kuò)展語(yǔ)法即Spread Syntax(…) 是 ES6 中引入的一個(gè)新特性,它允許我們從可迭代對(duì)象中快速提取元素2022-07-07








