欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于jQuery插件實(shí)現(xiàn)點(diǎn)擊小圖顯示大圖效果

 更新時間:2016年05月11日 14:13:19   作者:wangjingjing1014  
這篇文章主要為大家詳細(xì)介紹了基于jQuery實(shí)現(xiàn)點(diǎn)擊小圖顯示大圖效果的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了基于jQuery實(shí)現(xiàn)點(diǎn)擊小圖顯示大圖效果,供大家參考,具體內(nèi)容如下

顯示以下效果

點(diǎn)擊任意一張圖片會顯示大圖

1、前臺界面

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="練習(xí).WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <title></title>
   <style type="text/css">
   #mydiv ul{ list-style-type:none;}
   #mydiv ul li{ display:inline;}
   #mydiv{ width:500px; border:solid 1px #444; background-color:#333;} 
   </style>
   <link href="css/nf.lightbox.css" rel="stylesheet" type="text/css" />
   <script src="Jquery1.7.js" type="text/javascript"></script>
   <script src="js/NFLightBox.js" type="text/javascript"></script>
   <script type="text/javascript">
    $(function () {
     //var settings = { containerResizeSpeed: 3000 };
     $('#mydiv ul a').lightBox({ containerResizeSpeed: 1000 });
    })
  
   </script>
</head>
<body>
<form id="form1" runat="server">
 <div id="mydiv" runat="server">
 
 </div>
 </form>

</body>
</html>

2、后臺代碼

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Text;

namespace 練習(xí)
{
 public partial class WebForm1 : System.Web.UI.Page
 {
  protected void Page_Load(object sender, EventArgs e)
  {

   if (!IsPostBack)
   {
    LoadData();
   }
  }
 private void LoadData() 
  {
   string constr = "data source=LOVE-PC\\SQLEXPRESSPC;initial catalog=BoKe;user id=sa;password=admin";
   using (SqlConnection conn = new SqlConnection(constr))
   {
    using (SqlCommand cmd =conn.CreateCommand())
    {
     conn.Open();
     cmd.CommandText = "select BigImgUrl,SmallImgUrl from T_Photo";
     SqlDataAdapter adapter = new SqlDataAdapter(cmd);
     DataTable dt = new DataTable();
     adapter.Fill(dt);
     StringBuilder sb = new StringBuilder();
     sb.Append("<ul>");
     for (int i = 0; i < dt.Rows.Count; i++)
     {
      sb.Append("<a href=" + dt.Rows[i]["BigImgUrl"] + ">");//添圖片路徑
      sb.Append("<li>");
      sb.Append("<img src=" + dt.Rows[i]["SmallImgUrl"] + ">");//添圖片路徑
      sb.Append("</li>");
      sb.Append("</a>");


     }
     sb.Append("</ul>");
      mydiv.InnerHtml = sb.ToString();
    }
   }
   
  }
 }
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助。

相關(guān)文章

  • 解決jquery插件:TypeError:$.browser is undefined報(bào)錯的方法

    解決jquery插件:TypeError:$.browser is undefined報(bào)錯的方法

    這篇文章為大家分享了一個解決jquery插件:TypeError:$.browser is undefined報(bào)錯的方法,解決報(bào)錯問題的方法也很簡單,需要解決此類問題的朋友不要錯過這篇文章。
    2015-11-11
  • 簡潔實(shí)用的BootStrap jQuery手風(fēng)琴插件

    簡潔實(shí)用的BootStrap jQuery手風(fēng)琴插件

    這篇文章主要介紹了簡潔實(shí)用的BootStrap jQuery手風(fēng)琴插件知識,非常不錯,具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-08-08
  • jquery實(shí)現(xiàn)圖片裁剪思路及實(shí)現(xiàn)

    jquery實(shí)現(xiàn)圖片裁剪思路及實(shí)現(xiàn)

    JS,jquery不能實(shí)現(xiàn)圖片的裁剪,只是顯示了一個假象,在服務(wù)器上用獲得的各個坐標(biāo)值,以及原始圖片,用JAVA進(jìn)行裁剪
    2013-08-08
  • jQuery對底部導(dǎo)航進(jìn)行跳轉(zhuǎn)并高亮顯示的實(shí)例代碼

    jQuery對底部導(dǎo)航進(jìn)行跳轉(zhuǎn)并高亮顯示的實(shí)例代碼

    這篇文章主要介紹了jQuery對底部導(dǎo)航進(jìn)行跳轉(zhuǎn)并高亮顯示的實(shí)例代碼,代碼簡單易懂,非常不錯,具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下
    2019-04-04
  • jQuery實(shí)現(xiàn)圖片跟隨效果

    jQuery實(shí)現(xiàn)圖片跟隨效果

    這篇文章主要為大家詳細(xì)介紹了jQuery實(shí)現(xiàn)圖片跟隨效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • jQuery檢測滾動條是否到達(dá)底部

    jQuery檢測滾動條是否到達(dá)底部

    這篇文章主要介紹了jQuery檢測滾動條是否到達(dá)底部的實(shí)現(xiàn)方法,文中介紹了兩種檢測滾動條到達(dá)底部的狀況,感興趣的小伙伴們可以參考一下
    2015-12-12
  • 最新評論