日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
JS實(shí)現(xiàn)多圖點(diǎn)擊切換,鼠標(biāo)移上放大

繼 javascript 簡(jiǎn)單的圖片放大效果(一) 之后,把這個(gè)效果完善了一下,支持多圖輪流切換,如下:

創(chuàng)新互聯(lián)公司是專業(yè)的平邑網(wǎng)站建設(shè)公司,平邑接單;提供網(wǎng)站制作、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行平邑網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!

本次采用代碼封裝到一個(gè)對(duì)象的模式,和***次函數(shù)式寫法不一下,這樣更清晰,添加自定義屬性更方便,全部代碼如下:

大圖的地址用自定義屬性的方式顯示在標(biāo)簽如

 
 
 

 
 
 
  1.     
  2.     圖片放大實(shí)例
  3.     
  4.     
  5.         * {
  6.             margin: 0;
  7.             padding: 0;
  8.         }
  9.         #zoomWarp {
  10.             width: 1000px;
  11.             margin: 20px auto;
  12.             overflow: hidden;
  13.         }
  14.         #smallwarp {
  15.             position: relative;
  16.             border: 1px solid #000;
  17.             width: 300px;
  18.             height: 300px;
  19.             float: left;
  20.             overflow: hidden;
  21.         }
  22.         #minImg {
  23.             float: left;
  24.             display: inline;
  25.             margin-right: 5px;
  26.         }
  27.         #minImg li {
  28.             width: 70px;
  29.             height: 70px;
  30.             overflow: hidden;
  31.             background: #ccc;
  32.             margin-bottom: 5px;
  33.             border: 1px solid #333;
  34.             cursor: pointer;
  35.             list-style: none;
  36.         }
  37.         #minImg li.lastChild {
  38.             margin-bottom: 0;
  39.         }
  40.     
  41.     
  42.         
  43.         
  44.         
  45.         
  46.     
  47.     
  48.         
  49.     
  • #p#

    VVG.base庫代碼:

     
     
     
    1. /*
    2.  *    簡(jiǎn)單JS庫封裝  By VVG
    3.  *    @namespace VVG
    4.  *    E-mail:mysheller@163.com    QQ:83816819
    5.  */
    6. if (!String.trim) {
    7.     String.prototype.trim = function () {
    8.         var reg = /^\s+|\s+$/g;
    9.         return this.replace(reg, '');
    10.     }
    11. }
    12. (function () {
    13.     // create namespace VVG
    14.     if (!window.VVG) {
    15.         window.VVG = {};
    16.     }
    17.     function isCompatible(other) {
    18.         // Use capability detection to check requirements
    19.         if (other === false || !Array.prototype.push || !Object.hasOwnProperty || !document.createElement || !document.getElementsByTagName) {
    20.             alert('你的瀏覽器不支持某些特性!');
    21.             return false;
    22.         }
    23.         return true;
    24.     }
    25.     window.VVG.isCompatible = isCompatible;
    26.     // getElementById function
    27.     function $() {
    28.         var elements = new Array();
    29.         for (var i = 0; i < arguments.length; i++) {
    30.             var element = arguments[i];
    31.             if (typeof element == 'string') {
    32.                 element = document.getElementById(element);
    33.             }
    34.             if (!element) {
    35.                 continue;
    36.             }
    37.             // 如果只有一個(gè)參數(shù),則返回
    38.             if (arguments.length == 1) {
    39.                 return element;
    40.             }
    41.             // 多個(gè)參數(shù)的時(shí)候存為數(shù)組
    42.             elements.push(element);
    43.         }
    44.         // 返回?cái)?shù)組
    45.         return elements;
    46.     }
    47.     window.VVG.$ = $;
    48.     // 獲取Parent父元素下標(biāo)簽名為child 的 Tags
    49.     function $$(tag, parent) {
    50.         parentparent = parent || document;
    51.         return $(parent).getElementsByTagName(tag);
    52.     }
    53.     window.VVG.$$ = $$;
    54.     // getElementsByClassName
    55.     function $$$(str, parent, tag) {
    56.         //父節(jié)點(diǎn)存在
    57.         if (parent) {
    58.             parent = $(parent);
    59.         } else {
    60.             // 未傳值時(shí),父節(jié)點(diǎn)為body
    61.             parent = document;
    62.         }
    63.         // tagContent為節(jié)點(diǎn)類型,未傳值時(shí)為all節(jié)點(diǎn)
    64.         tagtag = tag || '*';
    65.         // 在父節(jié)點(diǎn)查找子節(jié)點(diǎn),建立空數(shù)組arr
    66.         var els = parent.getElementsByTagName(tag),
    67.             arr = [];
    68.         for (var i = 0, n = els.length; i < n; i++) {
    69.             // 查找每個(gè)節(jié)點(diǎn)下的classname,以空格分離為一個(gè)k數(shù)組
    70.             for (var j = 0, k = els[i].className.split(' '), l = k.length; j < 1; j++) {
    71.                 // 當(dāng)K數(shù)組中有一個(gè)值與str值相等時(shí),記住這個(gè)標(biāo)簽并推入arr數(shù)組
    72.                 if (k[j] == str) {
    73.                     arr.push(els[i]);
    74.                     break;
    75.                 }
    76.             }
    77.         }
    78.         // 返回?cái)?shù)組
    79.         return arr;
    80.     }
    81.     window.VVG.$$$ = $$$;
    82.     window.VVG.getElementsByClassName = $$$;
    83.     // Event事件綁定:綁定type事件到element元素,觸發(fā)func函數(shù)
    84.     function bindEvent(element, type, func) {
    85.         if (element.addEventListener) {
    86.             element.addEventListener(type, func, false); //false 表示冒泡
    87.         } else if (element.attachEvent) {
    88.             element.attachEvent('on' + type, func);
    89.         } else {
    90.             element['on' + type] = func;
    91.         }
    92.     }
    93.     window.VVG.bindEvent = bindEvent;
    94.     // 解除Event事件綁定
    95.     function unbindEvent(element, type, func) {
    96.         if (element.removeEventListener) {
    97.             element.removeEventListener(type, func, false);
    98.         } else if (element.detachEvent) {
    99.             element.detachEvent('on' + type, func);
    100.         } else {
    101.             element['on' + type] = null;
    102.         }
    103.     }
    104.     window.VVG.unbindEvent = unbindEvent;
    105.     // 獲取事件
    106.     function getEvent(event) {
    107.         return event || window.event;
    108.     }
    109.     window.VVG.getEvent = getEvent;
    110.     // 獲取事件目標(biāo)
    111.     function getTarget(event) {
    112.         return event.target || event.srcElement;
    113.     }
    114.     window.VVG.getTarget = getTarget;
    115.     // 獲取鼠標(biāo)位于文檔的坐標(biāo)
    116.     function getMousePositionInPage(event) {
    117.         event = getEvent(event);
    118.         return {
    119.             'x':event.pageX || event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft),
    120.             'y':event.pageY || event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)
    121.         }
    122.     }
    123.     window.VVG.getMousePositionInPage = getMousePositionInPage;
    124.     // 停止事件冒泡
    125.     function stopPropagation(event) {
    126.         if (event.stopPropagation) {
    127.             event.stopPropagation();
    128.         } else {
    129.             event.cancelBubble = true;
    130.         }
    131.     }
    132.     window.VVG.stopPropagation = stopPropagation;
    133.     // 阻止默認(rèn)事件
    134.     function preventDefault(event) {
    135.         if (event.preventDefault) {
    136.             event.preventDefault();
    137.         } else {
    138.             event.returnValue = false;
    139.         }
    140.     }
    141.     window.VVG.preventDefault = preventDefault;
    142.     //  apply從新定義函數(shù)的執(zhí)行環(huán)境
    143.     function bindFunction(obj, func) {
    144.         return function () {
    145.             return func.apply(obj, arguments);
    146.         };
    147.     }
    148.     window.VVG.bindFunction = bindFunction;
    149.     // 設(shè)置透明度
    150.     function setOpacity(node, level) {
    151.         node = $(node);
    152.         if (document.all) {
    153.             node.style.filter = 'alpha(opacity=' + level + ')';
    154.         } else {
    155.             node.style.opacity = level / 100;
    156.         }
    157.     }
    158.     window.VVG.setOpacity = setOpacity;
    159.     // 獲取可視窗口尺寸
    160.     function getWindowSize() {
    161.         var de = document.documentElement;
    162.         return {
    163.             'width':(
    164.                 window.innerWidth || (de && de.clientWidth) || document.body.clientWidth),
    165.             'height':(
    166.                 window.innerHeight || (de && de.clientHeight) || document.body.clientHeight)
    167.         }
    168.     }
    169.     window.VVG.getWindowSize = getWindowSize;
    170.     //  數(shù)字轉(zhuǎn)化為千分位格式函數(shù)
    171.     function thousandsNumberFormat(str) {
    172.         var n = str.length;
    173.         var c = n % 3;
    174.         var reg = /\d{3}(?!$)/g;
    175.         if (n > 3) {
    176.             var strstr1 = str.slice(0, c);
    177.             var strstr2 = str.slice(c, n);
    178.             str1str1 = str1 ? str1 + ',' : '';
    179.             str = str1 + str2.replace(reg, function (p1) {
    180.                 return p1 + ',';
    181.             })
    182.         }
    183.         return str;
    184.     }
    185.     window.VVG.thousandsNumberFormat = thousandsNumberFormat;
    186.     // 帶橫杠的字符形式轉(zhuǎn)化為駝峰式命名
    187.     function camelize(string) {
    188.         return string.replace(/-(\w)/g, function (strMatch, p1) {
    189.             return p1.toUpperCase();
    190.         });
    191.     }
    192.     window.VVG.camelize = camelize;
    193.     // 駝峰式轉(zhuǎn)化為橫杠分隔
    194.     function uncamelize(string, sep) {
    195.         sepsep = sep || '-';
    196.         return string.replace(/([a-z])([A-Z])/g, function (strMatch, p1, p2) {
    197.             return p1 + sep + p2.toLowerCase();
    198.         });
    199.     }
    200.     window.VVG.uncamelize = uncamelize;
    201.     // 設(shè)置根據(jù)ID設(shè)置樣式
    202.     function setStyleById(element, cssjson) {
    203.         element = $(element);
    204.         for (property in cssjson) {
    205.             if (!cssjson.hasOwnProperty(property)) continue;
    206.             if
      網(wǎng)站名稱:JS實(shí)現(xiàn)多圖點(diǎn)擊切換,鼠標(biāo)移上放大
      文章來源:http://www.5511xx.com/article/cophgcc.html