zoukankan      html  css  js  c++  java
  • 【原创】jquery图片移动

    先发个最终的预览效果图

    //初始化向上可点次数
    var topT = 0;
    //初始化向下可点次数
    var bottomT = 0;
    //注:theback.piclist为服务器端返回的数据
    var plist = theback.piclist.split(',');
    var sleft = "";
    //总的可点击次数
    var totalT = plist.length - 5;
    //初始化向上可点次数
    topT = totalT;
    //图片大于5张
    if (plist.length > 5) {
    sleft
    += "<span id=\"js_up\"><a href=\"#\" onclick=\"MoveT('top')\"><img src=\"images/icon_09.gif\" /></a></span>";
    }
    sleft
    += "<span class=\"js_leftimg\"><div>";
    for (var i = 0; i < plist.length; i++) {
    sleft
    += "<a href=\"#\" class=\"xt\"><img onclick=\"LoadBigImage('" + plist[i] + "')\" src=\"" + plist[i] + "\" /></a>";
    }
    sleft
    += "</div></span>";
    //图片大于5张
    if (plist.length > 5) {
    sleft
    += "<span id=\"js_down\"><a href=\"#\" ><img src=\"images/icon_26.gif\" /></a></span>";
    }
    //左边小图列表
    $(".lfxt").html(sleft);


    //根据方向移动
    function MoveT(d) {
    if (d == "top") {
    if (topT > 0) {
    topT
    --;
    bottomT
    ++;
    $(
    ".js_leftimg div").animate({ top: '-=66px' }, "slow");
    }
    }
    else {
    if (bottomT > 0) {
    topT
    ++;
    bottomT
    --;
    $(
    ".js_leftimg div").animate({ top: '+=66px' }, "slow");
    }
    }
    if (topT != 0) {
    $(
    "#js_up").html("<a href=\"#\" id=\"js_up\" onclick=\"MoveT('top')\" ><img src=\"images/icon_09.gif\" /></a>");
    }
    else {
    $(
    "#js_up").html("<a href=\"#\" onclick=\"javascript:void(0)\"><img src=\"images/icon_16.gif\" /></a>");
    }
    if (bottomT != 0) {
    $(
    "#js_down").html("<a href=\"#\" onclick=\"MoveT('bottom')\" ><img src=\"images/icon_13.gif\" /></a>");
    }
    else {
    $(
    "#js_down").html("<a href=\"#\" onclick=\"javascript:void(0)\" ><img src=\"images/icon_26.gif\" /></a>");
    }
    }
  • 相关阅读:
    攻防一体 暴力攻击
    新的亮眼的但不彻底的交互
    利用物联网或智能化区分产品
    Character Sets, Collation, Unicode :: utf8_unicode_ci vs utf8_general_ci
    容灾 RPO RTO
    微信找人代付 下单账号 支付账号
    微信公众号 openId 支付 php中file_get_contents与curl性能比较分析
    t
    accesstoken 中控服务器 并发刷新 加并发锁
    a
  • 原文地址:https://www.cnblogs.com/zhxhdean/p/2072098.html
Copyright © 2011-2022 走看看