点击小图轮播,点击显示大图

 <script type="text/javascript">
        var scrollPic1Index = 0, scrollPic2Index = 0, len = 0, len2 = 0, caseopenlength = 0, caseopenlength2 = 0;
        function showScrollPic1(index) {
            scrollPic1Index = $(index).index();
            $(".caseOpenBox").eq(0).show();
            $("#caseOpenContents1 li").eq(scrollPic1Index).show().siblings().hide();
        }
        function showScrollPic2(index) {
            // scrollPic2Index = index;
            scrollPic2Index = $(index).index();
            $(".caseOpenBox").eq(1).show(); $("#caseOpenContents2 li").eq(scrollPic2Index).show().siblings().hide();
        }
        function caseOpenContents1Show(m) {
            caseopenlength = $("#caseOpenContents1 li").length;
            if (m == "+") {
                ++scrollPic1Index;
            }
            if (m == "-") {
                --scrollPic1Index;
            }
            if (scrollPic1Index >= caseopenlength)
                scrollPic1Index = 0;
            if (scrollPic1Index < 0)
                scrollPic1Index = caseopenlength - 1;
            $("#caseOpenContents1 li").eq(scrollPic1Index).show().siblings().hide();
        }
        function caseOpenContents2Show(m) {
            caseopenlength2 = $("#caseOpenContents2 li").length;
            if (m == "+") {
                ++scrollPic2Index;
            }
            if (m == "-") {
                --scrollPic2Index;
            }
            if (scrollPic2Index >= caseopenlength2)
                scrollPic2Index = 0;
            if (scrollPic2Index < 0)
                scrollPic2Index = caseopenlength2 - 1;
            $("#caseOpenContents2 li").eq(scrollPic2Index).show().siblings().hide();
        }

        function firstShow(m) {
            len = $("#caseContents1 li").length;
            caseopenlength1 = $("#caseOpenContents2 li").length;
            if (m == "+") {
                $("#caseContents1 li").eq(0).insertAfter($("#caseContents1 li").eq(len - 1));
                $("#caseOpenContents1 li").eq(0).insertAfter($("#caseOpenContents1 li").eq(caseopenlength - 1));
            }
            if (m == "-") {
                $("#caseContents1 li").eq(len - 1).insertBefore($("#caseContents1 li").eq(0));
                $("#caseOpenContents1 li").eq(caseopenlength - 1).insertBefore($("#caseOpenContents1 li").eq(0));
            }
        }
        function secondShow(m) {
            len2 = $("#caseContents2 li").length;
            caseopenlength2 = $("#caseOpenContents2 li").length;
            if (m == "+") {
                $("#caseContents2 li").eq(0).insertAfter($("#caseContents2 li").eq(len2 - 1));
                $("#caseOpenContents2 li").eq(0).insertAfter($("#caseOpenContents2 li").eq(caseopenlength2 - 1));
            }
            if (m == "-") {
                $("#caseContents2 li").eq(len2 - 1).insertBefore($("#caseContents2 li").eq(0));
                $("#caseOpenContents2 li").eq(caseopenlength2 - 1).insertBefore($("#caseOpenContents2 li").eq(0));
            }
        }
    </script>
    <style>
        #hz6d_kf_icon_1
        {
            width: 140px;
            top: 50px;
        }
        /*.town
        {
            overflow: auto;
        }*/
    </style>
<div class="ContentBox07">
        <h2 id="anchor04" class="title04">
            应用案例</h2>
        <div class="ContentBox07_Contents">
            <div class="caseContents">
                <div class="caseOpenBox" style="display: none;">
                    <p>
                        <a href="javascript:void(0);" onclick="$(this).parent().parent().hide();">
                            <img src="images/caseClose.png" /></a></p>
                    <p class="clear">
                    </p>
                    <div class="caseOpenBox00">
                        <a href="javascript:void(0);" class="caseOpen_arrowLe" onclick="caseOpenContents1Show(‘-‘)">
                            <img src="images/caseOpen_arrowLe.png" /></a>
                        <div class="caseOpenContents" id="caseOpenContents1">
                            <ul>
                                <asp:Repeater ID="rptBigPic1" runat="server">
                                    <ItemTemplate>
                                        <li><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Bigpic") %>" style="width: 807px; height: 485px;" /></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:void(0);" class="caseOpen_arrowRi" onclick="caseOpenContents1Show(‘+‘)">
                            <img src="images/caseOpen_arrowRi.png" /></a>
                    </div>
                </div>
                <div class="caseOpenBox" style="display: none;">
                    <p>
                        <a href="javascript:void(0)" onclick="$(this).parent().parent().hide();">
                            <img src="images/caseClose.png" /></a></p>
                    <p class="clear">
                    </p>
                    <div class="caseOpenBox00">
                        <a href="javascript:void(0);" class="caseOpen_arrowLe" onclick="caseOpenContents2Show(‘-‘)">
                            <img src="images/caseOpen_arrowLe.png" /></a>
                        <div class="caseOpenContents" id="caseOpenContents2">
                            <ul>
                                <asp:Repeater ID="rptBigPic2" runat="server">
                                    <ItemTemplate>
                                        <li><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Bigpic") %>" style="width: 807px; height: 485px;" /></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:void(0);" class="caseOpen_arrowRi" onclick="caseOpenContents2Show(‘+‘)">
                            <img src="images/caseOpen_arrowRi.png" /></a>
                    </div>
                </div>
                <div class="caseBox">
                    <h3>
                        <img src="images/caseTitle00.jpg" /></h3>
                    <div class="caseBox00">
                        <a href="javascript:" class="arrowLe" id="caseContents1_left">
                            <img src="images/arrowLe.png" onclick="firstShow(‘-‘)" /></a>
                        <div class="caseContents" id="caseContents1">
                            <ul>
                                <asp:Repeater ID="rptCase" runat="server">
                                    <ItemTemplate>
                                        <li onclick="showScrollPic1(this);"><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Smallpic") %>" style="width: 259px; height: 155px;" /></a>
                                            <p class="caseDetails">
                                                安装地点:<%# Eval("InstallationAddress")%><br />
                                                用户户型:<%# Eval("InstallDoor")%><br />
                                                产品型号:<%# Eval("ProductModel")%><br />
                                                使用人数:日常<%# Eval("UserNum")%>人用水
                                            </p>
                                        </li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:" class="arrowRi" id="caseContents1_right">
                            <img src="images/arrowRi.png" onclick="firstShow(‘+‘)" /></a>
                    </div>
                </div>
                <div class="caseBox">
                    <h3>
                        <img src="images/caseTitle01.jpg" /></h3>
                    <div class="caseBox00">
                        <a href="javascript:" class="arrowLe" id="caseContents2_left">
                            <img src="images/arrowLe.png" onclick="secondShow(‘-‘)" /></a>
                        <div class="caseContents" id="caseContents2">
                            <ul>
                                <asp:Repeater ID="rptCase2" runat="server">
                                    <ItemTemplate>
                                        <li onclick="showScrollPic2(this);"><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Smallpic") %>" style="width: 259px; height: 155px;" /></a>
                                            <p class="caseDetails">
                                                安装地点:<%# Eval("InstallationAddress")%><br />
                                                用户户型:<%# Eval("InstallDoor")%><br />
                                                产品型号:<%# Eval("ProductModel")%><br />
                                                使用人数:日常<%# Eval("UserNum")%>人用水
                                            </p>
                                        </li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:" class="arrowRi" id="caseContents2_right">
                            <img src="images/arrowRi.png" onclick="secondShow(‘+‘)" /></a>
                    </div>
                </div>
            </div>
        </div>
    </div>
<div class="ContentBox07">
        <h2 id="anchor04" class="title04">
            应用案例</h2>
        <div class="ContentBox07_Contents">
            <div class="caseContents">
                <div class="caseOpenBox" style="display: none;">
                    <p>
                        <a href="javascript:void(0);" onclick="$(this).parent().parent().hide();">
                            <img src="images/caseClose.png" /></a></p>
                    <p class="clear">
                    </p>
                    <div class="caseOpenBox00">
                        <a href="javascript:void(0);" class="caseOpen_arrowLe" onclick="caseOpenContents1Show(‘-‘)">
                            <img src="images/caseOpen_arrowLe.png" /></a>
                        <div class="caseOpenContents" id="caseOpenContents1">
                            <ul>
                                <asp:Repeater ID="rptBigPic1" runat="server">
                                    <ItemTemplate>
                                        <li><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Bigpic") %>" style="width: 807px; height: 485px;" /></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:void(0);" class="caseOpen_arrowRi" onclick="caseOpenContents1Show(‘+‘)">
                            <img src="images/caseOpen_arrowRi.png" /></a>
                    </div>
                </div>
                <div class="caseOpenBox" style="display: none;">
                    <p>
                        <a href="javascript:void(0)" onclick="$(this).parent().parent().hide();">
                            <img src="images/caseClose.png" /></a></p>
                    <p class="clear">
                    </p>
                    <div class="caseOpenBox00">
                        <a href="javascript:void(0);" class="caseOpen_arrowLe" onclick="caseOpenContents2Show(‘-‘)">
                            <img src="images/caseOpen_arrowLe.png" /></a>
                        <div class="caseOpenContents" id="caseOpenContents2">
                            <ul>
                                <asp:Repeater ID="rptBigPic2" runat="server">
                                    <ItemTemplate>
                                        <li><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Bigpic") %>" style="width: 807px; height: 485px;" /></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:void(0);" class="caseOpen_arrowRi" onclick="caseOpenContents2Show(‘+‘)">
                            <img src="images/caseOpen_arrowRi.png" /></a>
                    </div>
                </div>
                <div class="caseBox">
                    <h3>
                        <img src="images/caseTitle00.jpg" /></h3>
                    <div class="caseBox00">
                        <a href="javascript:" class="arrowLe" id="caseContents1_left">
                            <img src="images/arrowLe.png" onclick="firstShow(‘-‘)" /></a>
                        <div class="caseContents" id="caseContents1">
                            <ul>
                                <asp:Repeater ID="rptCase" runat="server">
                                    <ItemTemplate>
                                        <li onclick="showScrollPic1(this);"><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Smallpic") %>" style="width: 259px; height: 155px;" /></a>
                                            <p class="caseDetails">
                                                安装地点:<%# Eval("InstallationAddress")%><br />
                                                用户户型:<%# Eval("InstallDoor")%><br />
                                                产品型号:<%# Eval("ProductModel")%><br />
                                                使用人数:日常<%# Eval("UserNum")%>人用水
                                            </p>
                                        </li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:" class="arrowRi" id="caseContents1_right">
                            <img src="images/arrowRi.png" onclick="firstShow(‘+‘)" /></a>
                    </div>
                </div>
                <div class="caseBox">
                    <h3>
                        <img src="images/caseTitle01.jpg" /></h3>
                    <div class="caseBox00">
                        <a href="javascript:" class="arrowLe" id="caseContents2_left">
                            <img src="images/arrowLe.png" onclick="secondShow(‘-‘)" /></a>
                        <div class="caseContents" id="caseContents2">
                            <ul>
                                <asp:Repeater ID="rptCase2" runat="server">
                                    <ItemTemplate>
                                        <li onclick="showScrollPic2(this);"><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Smallpic") %>" style="width: 259px; height: 155px;" /></a>
                                            <p class="caseDetails">
                                                安装地点:<%# Eval("InstallationAddress")%><br />
                                                用户户型:<%# Eval("InstallDoor")%><br />
                                                产品型号:<%# Eval("ProductModel")%><br />
                                                使用人数:日常<%# Eval("UserNum")%>人用水
                                            </p>
                                        </li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:" class="arrowRi" id="caseContents2_right">
                            <img src="images/arrowRi.png" onclick="secondShow(‘+‘)" /></a>
                    </div>
                </div>
            </div>
        </div>
    </div>
 <div class="ContentBox07">
        <h2 id="anchor04" class="title04">
            应用案例</h2>
        <div class="ContentBox07_Contents">
            <div class="caseContents">
                <div class="caseOpenBox" style="display: none;">
                    <p>
                        <a href="javascript:void(0);" onclick="$(this).parent().parent().hide();">
                            <img src="images/caseClose.png" /></a></p>
                    <p class="clear">
                    </p>
                    <div class="caseOpenBox00">
                        <a href="javascript:void(0);" class="caseOpen_arrowLe" onclick="caseOpenContents1Show(‘-‘)">
                            <img src="images/caseOpen_arrowLe.png" /></a>
                        <div class="caseOpenContents" id="caseOpenContents1">
                            <ul>
                                <asp:Repeater ID="rptBigPic1" runat="server">
                                    <ItemTemplate>
                                        <li><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Bigpic") %>" style="width: 807px; height: 485px;" /></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:void(0);" class="caseOpen_arrowRi" onclick="caseOpenContents1Show(‘+‘)">
                            <img src="images/caseOpen_arrowRi.png" /></a>
                    </div>
                </div>
                <div class="caseOpenBox" style="display: none;">
                    <p>
                        <a href="javascript:void(0)" onclick="$(this).parent().parent().hide();">
                            <img src="images/caseClose.png" /></a></p>
                    <p class="clear">
                    </p>
                    <div class="caseOpenBox00">
                        <a href="javascript:void(0);" class="caseOpen_arrowLe" onclick="caseOpenContents2Show(‘-‘)">
                            <img src="images/caseOpen_arrowLe.png" /></a>
                        <div class="caseOpenContents" id="caseOpenContents2">
                            <ul>
                                <asp:Repeater ID="rptBigPic2" runat="server">
                                    <ItemTemplate>
                                        <li><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Bigpic") %>" style="width: 807px; height: 485px;" /></a></li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:void(0);" class="caseOpen_arrowRi" onclick="caseOpenContents2Show(‘+‘)">
                            <img src="images/caseOpen_arrowRi.png" /></a>
                    </div>
                </div>
                <div class="caseBox">
                    <h3>
                        <img src="images/caseTitle00.jpg" /></h3>
                    <div class="caseBox00">
                        <a href="javascript:" class="arrowLe" id="caseContents1_left">
                            <img src="images/arrowLe.png" onclick="firstShow(‘-‘)" /></a>
                        <div class="caseContents" id="caseContents1">
                            <ul>
                                <asp:Repeater ID="rptCase" runat="server">
                                    <ItemTemplate>
                                        <li onclick="showScrollPic1(this);"><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Smallpic") %>" style="width: 259px; height: 155px;" /></a>
                                            <p class="caseDetails">
                                                安装地点:<%# Eval("InstallationAddress")%><br />
                                                用户户型:<%# Eval("InstallDoor")%><br />
                                                产品型号:<%# Eval("ProductModel")%><br />
                                                使用人数:日常<%# Eval("UserNum")%>人用水
                                            </p>
                                        </li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:" class="arrowRi" id="caseContents1_right">
                            <img src="images/arrowRi.png" onclick="firstShow(‘+‘)" /></a>
                    </div>
                </div>
                <div class="caseBox">
                    <h3>
                        <img src="images/caseTitle01.jpg" /></h3>
                    <div class="caseBox00">
                        <a href="javascript:" class="arrowLe" id="caseContents2_left">
                            <img src="images/arrowLe.png" onclick="secondShow(‘-‘)" /></a>
                        <div class="caseContents" id="caseContents2">
                            <ul>
                                <asp:Repeater ID="rptCase2" runat="server">
                                    <ItemTemplate>
                                        <li onclick="showScrollPic2(this);"><a href="javascript:void(0);">
                                            <img src="/Files/HeatPump/<%# Eval("Smallpic") %>" style="width: 259px; height: 155px;" /></a>
                                            <p class="caseDetails">
                                                安装地点:<%# Eval("InstallationAddress")%><br />
                                                用户户型:<%# Eval("InstallDoor")%><br />
                                                产品型号:<%# Eval("ProductModel")%><br />
                                                使用人数:日常<%# Eval("UserNum")%>人用水
                                            </p>
                                        </li>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ul>
                        </div>
                        <a href="javascript:" class="arrowRi" id="caseContents2_right">
                            <img src="images/arrowRi.png" onclick="secondShow(‘+‘)" /></a>
                    </div>
                </div>
            </div>
        </div>
    </div>


				
时间: 2024-11-06 03:32:32

点击小图轮播,点击显示大图的相关文章

js 基础篇(点击事件轮播图的实现)

轮播图在以后的应用中还是比较常见的,不需要多少行代码就能实现.但是在只掌握了js基础知识的情况下,怎么来用较少的而且逻辑又简单的方法来实现呢?下面来分析下几种不同的做法: 1.利用位移的方法来实现 首先,我们可以在body中添加一个div并且将宽度设置成百分比(自适应页面),比例具体是相对谁的百分比的话按需求来做,在这里不多说.将图片放入到div 中. 其次,样式部分将img标签全部设置成absolute:以方便定位 最后,js部分说说逻辑,定义两个空数组,第一个数组用来保存初始的显示在页面的图

实现图片点击左右轮播

这个 相当于一个小框架,拿来就可以用: 1. 功能: 如上图显示: 点击左右两个button,可以实现图片向左右滚动,也可以设置在多少秒自己滚动. 2. 首先建立一个js文件,文件名为play.js(只要和HTML中的引入相同就可以了): 1 var sina = { 2 $: function(objName) { 3 if (document.getElementById) { 4 return eval('document.getElementById("' + objName + '&q

图片轮播点击进入WebView

ImageView1 ImageView2 ImageView3 ImageView4(轮播的四张图片) 得到图片资源 int[] images = {R.drawable.banner1, R.drawable.banner2, R.drawable.banner3, R.drawable.banner4}; ImageView.setBackgroundResource(images[i]); 点击图片的链接地址 拿到后台数据解析后,给每个ImageView设置背景资源 ImageView.

图片轮播_支持显示网络图片及下载图片至SD后再显示

现在的移动应用, 很常见的一个交互效果就是在首页顶部添加图片轮播的控件, 焦点图可以放入广告, 也可以放入文章的内容图片, 它们不断自动切换, 点击焦点图即跳至对应的界面. 交互效果很棒. 做图片轮播的效果, 方法并不少. 本文使用了常见的viewpager 去实现. 支持显示网络图片下载在缓存显示, 如果有SD卡则默认将图片下载至SD卡中再显示本地的图片. 其实网上这类代码已经很多,  应该也有很多写得比我好. 今天有点时间, 就做了个来练手, 顺便写下自己第一篇原创文章. 敲代码之前也参考了

Jquery 点击图片在弹出层显示大图

http://blog.csdn.net/wongwaidah/article/details/28432427(案例链接出处,本人只是转载收藏) <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"type="text/javascript"></scri

JS写一个图片库,点击缩略图在当前页面可以显示大图

<html><head> <meta charset="utf-8"> <title>缩略图</title> <style type="text/css"> body{ font-family: "Helvetica","Arial",serif; color:#333; background-color: #ccc; margin:1em 10%; }

轮播图不显示的坑

settings.py #设置文件上传路径,图片上传.文件上传都会存放在此目录里MEDIA_URL = '/media/'MEDIA_ROOT = os.path.join(BASE_DIR, 'media') #PEP8:missing whitespace around operator os前后有空格都不行 TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.pa

jquery特效(3)—轮播图①(手动点击轮播)

今天上班做设计做的头疼,就写了一个轮播图练练手,先写了一个手动点击轮播的轮播图,随后我会慢慢接着深入写自动轮播图和鼠标悬浮图片停止移动轮播图等~~~~~~虽然今天我生日,但是代码还是得写的,不能找借口放松自己,原地踏步也算后退~~~~ 下面来看看最终做的手动点击轮播效果: 哈哈哈,有没有看出来我的四张图片都是美男子哦~~~~找个赏心悦目的图片真不容易,这样才能激起我写轮播图的代码欲望,写出来就可以点击按钮翻他们牌子了~~~~ 一.原理说明 (1)首先是轮播图的架构,我采用了一个最外边的大div包

Jquery实现动态导航栏和轮播导航栏

动态导航栏和轮播导航栏的实现思想: 利用jquery技术的append()方法和bind()方法实现li标签的添加和点击事件绑定,在利用$getJSON(url,data,function)请求方法实现获取springmvc传递的list<map<String,Object>>的值.其中还遇到了浏览器兼容问题,主要是Mozilla Firefox兼容margin属性的值的问题,最后解决办法是:创建2(IE和FireFox)种类型的css样式,根据myBrowser()自定义方法判断