Bootstrap框架下实现图片切换
准备图片,把相关记录添加至数据库表中:
创建一个存储过程,获取所有记录:
在ASP.NET MVC专案中,部署Bootstrap环境......
然后创建一个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; }
}
}
Source Code
再创建一个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[];
return dt.ToList<Slider>();
}
}
}
Source Code
设置图片切换速度:
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" data-slide="prev">
<span class="icon-prev"></span>
</a> <a class="right carousel-control" href="#imgcarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</div>
</div>
Source Code
演示:
Bootstrap框架下实现图片切换的更多相关文章
- Winform下实现图片切换特效的方法
本文实例讲述了Winform下实现图片切换特效的方法,是应用程序开发中非常实用的一个功能.分享给大家供大家参考之用.具体方法如下: 本实例源自网络,功能较为齐全.丰富!主要功能代码如下: using ...
- bootstrap框架下 单选按钮组的选中以及取值问题
1.业务功能:四个按钮只能选中一个,且默认选择水准4 先看代码. <div class="btn-group" data-toggle="buttons" ...
- jQuery bootstrap框架下重置下拉框选择
前端页面中下拉选择框采用bootstrap-select美化,如下图:
- Bootstrap框架(基础篇)之按钮,网格,导航栏,下拉菜单
一,按钮 注意:虽然在Bootstrap框架中使用任何标签元素都可以实现按钮风格,但个人并不建议这样使用,为了避免浏览器兼容性问题,个人强烈建议使用button或a标签来制作按钮. 框架中提供了基础按 ...
- springMVC框架下——通用接口之图片上传接口
我所想要的图片上传接口是指服务器端在完成图片上传后,返回一个可访问的图片地址. spring mvc框架下图片上传非常简单,如下 @RequestMapping(value="/upload ...
- 2018-02-03-jekyll框架下的post如何显示图片
layout: post title: 2018-02-03-jekyll框架下的post如何显示图片 key: 20180203 tags: blog post modify_date: 2018- ...
- 实战web前端之:Bootstrap框架windows下安装与使用
Bootstrap是前端开发中比较受欢迎的框架,简洁且灵活.它基于HTML.CSS和JavaScript,HTML定义页面元素,CSS定义页面布局,而JavaScript负责页面元素的响应.Boots ...
- css去掉使用bootstrap框架后打印网页时预览效果下的超链接
在我们写网页的时候,超链接是链接各个页面的桥梁,也是搜索引擎爬虫(spider)收录网站页面的关键,因此,在每个网页中会有许多的超链. 今天,一个同行妹妹在使用了bootstrap框架来搭建自己的网站 ...
- Bootstrap 框架 day57
Bootstrap框架 Bootstrap介绍 Bootstrap是Twitter开源的基于HTML.CSS.JavaScript的前端框架. 它是为实现快速开发Web应用程序而设计的一套前端工具包 ...
随机推荐
- Permutations LT46
Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] O ...
- Mysql 常用增删改查命令集合教程
创建:create 插入:insert 更新:update 查询:select 删除:delete 修改:alter 销毁:drop 创建一个数据库: create databas ...
- Docker 介绍和使用
Docker 技术可以实现容器装载软件和依赖库,类似于封闭的Linux系统,默认相当于有root权限,可以快速移植和部署到其他机器上. Docker 容器技术可以理解为:仓库(储物间),镜像(类似于面 ...
- iOS中四种实例变量的范围类型@private@protected@public@package
文档上记录是这样的 The Scope of Instance Variables Toenforce the ability of an object to hide its data, the c ...
- Maven手动将jar包放入本地仓库
mvn install:install-file -Dfile=jar包的位置 -DgroupId=上面的groupId -DartifactId=上面的artifactId -Dversion=上面 ...
- docker 安装私服
官方的docker hub 提供了一个公共镜像服务器,但是有时候不希望自己 的镜像放到公网上,这个时候就需要创建自己的私服,用来存储管理自己的镜像. 1.安装私服 docker run -d -v $ ...
- Codeforces Round #543 (Div. 2) F dp + 二分 + 字符串哈希
https://codeforces.com/contest/1121/problem/F 题意 给你一个有n(<=5000)个字符的串,有两种压缩字符的方法: 1. 压缩单一字符,代价为a 2 ...
- idea设置字体大小
第一次玩儿idea,也是个新手小白,甚是惭愧,也是一步步慢慢摸索,下面我们按照步骤一步步操作 就可以了. 1.首先,先设置代码的字体大小: 2.设置周围菜单栏的字体大小: 3.设置控制台的字体大小:
- BZOJ 3259 [Sdoi2014]数表 (莫比乌斯反演 + 树状数组)
3529: [Sdoi2014]数表 Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 2321 Solved: 1187[Submit][Status ...
- shell 脚本学习
Shell简介 概述 Shell是一种具备特殊功能的程序,它提供了用户与内核进行交互操作的一种接口.它接收用户输入的命令,并把它送入内核去执行.内核是Linux系统的心脏,从开机自检就驻留在计算机的内 ...