基于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)文章
一文詳細(xì)分析前端請(qǐng)求中的“Unsupported?Media?Type”問(wèn)題
在Web開發(fā)中,前后端交互頻繁遇到HTTP狀態(tài)碼415錯(cuò)誤,這表明服務(wù)器無(wú)法處理因Content-Type不匹配的請(qǐng)求,常見于POST或PUT請(qǐng)求,必須確保請(qǐng)求頭中的Content-Type與服務(wù)器期望的一致,跨域請(qǐng)求中,需要的朋友可以參考下2024-10-10
javascript 面向?qū)ο蠹夹g(shù)基礎(chǔ)教程
看了很多介紹javascript面向?qū)ο蠹夹g(shù)的文章,很暈.為什么?不是因?yàn)閷懙貌缓?而是因?yàn)樘願(yuàn)W.2009-12-12
js實(shí)現(xiàn)的仿新浪微博完美的時(shí)間組件升級(jí)版
本博客沒有華麗的布局,只求樸實(shí)的js的代碼,只為js代碼愛好者提供,一周大概會(huì)出1-2篇js前沿代碼的文章.只是代碼,不說(shuō)技術(shù)2011-12-12
webpack-dev-server 的 host 配置 0.0.0.0的方法
這篇文章主要介紹了webpack-dev-server 的 host 配置 0.0.0.0的方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,,需要的朋友可以參考下2024-01-01
使用Mock.js生成前端測(cè)試數(shù)據(jù)
這篇文章主要介紹了使用Mock.js生成前端測(cè)試數(shù)據(jù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12
關(guān)于小程序優(yōu)化的一些建議(小結(jié))
這篇文章主要介紹了關(guān)于小程序優(yōu)化的一些建議(小結(jié)),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12








