ASP.NET中使用jQuery外掛程式實現圖片幻燈效果

來源:互聯網
上載者:User

標籤:des   blog   http   java   使用   os   資料   io   

參照網上的資料及提供的jQuery外掛程式實現圖片幻燈效果。

1、頁面前台代碼:

//頭部引用

<head runat="server">
<title></title>
<script type="text/javascript" src="scripts/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="scripts/jquery/jquery.KinSlideshow-1.2.1.min.js"></script>
<script type="text/javascript">
$(function () {
$("#focusNews").KinSlideshow();
})
</script>
</head>

<div id="focusNews" class="ifocus">
<asp:Repeater ID="FocusList" runat="server">
<ItemTemplate>
<a title=‘<%#Eval("Title")%>‘ target="_blank" href=‘<%#Eval("Href")%>‘>
<img src=‘<%#Eval("Src")%>‘ alt=‘<%#Eval("Title")%>‘ /></a>
</ItemTemplate>
</asp:Repeater>
</div>

2、後台代碼,主要是實現資料繫結:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindSlider();
}
}

private void BindSlider()
{
List<MyItem> list = new List<MyItem>();
MyItem item1 = new MyItem();
item1.Title = "item1";
item1.Src = "images/1.jpg";
item1.Href = "http://www.szit.edu.cn";
MyItem item2 = new MyItem();
item2.Title = "item2";
item2.Src = "images/2.jpg";
item2.Href = "http://www.sohu.com";
MyItem item3 = new MyItem();
item3.Title = "item3";
item3.Src = "images/3.jpg";
item3.Href = "http://www.sina.com";
list.Add(item1);
list.Add(item2);
list.Add(item3);
FocusList.DataSource = list;
FocusList.DataBind();
}
下載Demo

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.