Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
状态更改后,jQuery函数将消失_Jquery_Jquery Ui - Fatal编程技术网

状态更改后,jQuery函数将消失

状态更改后,jQuery函数将消失,jquery,jquery-ui,Jquery,Jquery Ui,当用户将鼠标悬停在图像上时,我使用jQuery的transfer()将图像移动到中间的图片框。下面是应该发生的事情: 用户将鼠标悬停在缩略图上 缩略图转移到页面中心的图片框 缩略图消失 用户将鼠标悬停在第二个缩略图上 此缩略图将替换中心帧中的其他图片,并重新显示第一个缩略图 用户再次将鼠标悬停在第一个缩略图上 重复步骤2-3 所有步骤1-5都在我的代码中工作,您可以在本文中看到。步骤6-7不起作用。这就好像是通过步骤2和3从图像中删除了传输代码。这是因为您正在使用one方法绑定事件。我已经修好了

当用户将鼠标悬停在图像上时,我使用jQuery的transfer()将图像移动到中间的图片框。下面是应该发生的事情:

  • 用户将鼠标悬停在缩略图上
  • 缩略图转移到页面中心的图片框
  • 缩略图消失
  • 用户将鼠标悬停在第二个缩略图上
  • 此缩略图将替换中心帧中的其他图片,并重新显示第一个缩略图
  • 用户再次将鼠标悬停在第一个缩略图上
  • 重复步骤2-3

  • 所有步骤1-5都在我的代码中工作,您可以在本文中看到。步骤6-7不起作用。这就好像是通过步骤2和3从图像中删除了传输代码。

    这是因为您正在使用
    one
    方法绑定事件。我已经修好了看这把小提琴

    代码

    var imgPath = new Object;
    imgPath["gen"] = "http://techfeed.net/dyany.com/images/genealogyLarge.png";
    imgPath["bo"] = "http://techfeed.net/dyany.com/images/BabyBoSayingOLarge.png";
    var lastImage = "";
    var transferInProgress = false;
    $(function() {
    
        function runTransfer(imgID) {
            if(transferInProgress)
                return;
            transferInProgress  = true;
            var options = { to: "#picFrame", className: "ui-effects-transfer" };
    
            // run the transfer
            $("#"+imgID).effect("transfer", options, 1000, afterTransfer(imgID));
        };
    
        function afterTransfer(imgID) {
            setTimeout(function() {
                $("#picFrame").html('<img src="'+imgPath[imgID]+'">');
                $("#"+imgID).hide();
                if ((lastImage != "") && (lastImage != imgID)) {
                    $("#"+lastImage).show();
                }
                lastImage = imgID;
                transferInProgress = false;
            }, 1000);
        };
    
        $("#gen, #bo").mouseover(function(){runTransfer(this.id); return false; });
    });
    
    var imgPath=新对象;
    imgPath[“gen”]=“http://techfeed.net/dyany.com/images/genealogyLarge.png";
    imgPath[“bo”]=“http://techfeed.net/dyany.com/images/BabyBoSayingOLarge.png";
    var lastImage=“”;
    var transferInProgress=假;
    $(函数(){
    函数运行转移(imgID){
    如果(转移程序)
    返回;
    transferInProgress=真;
    var options={to:“#picFrame”,className:“ui效果传输”};
    //运行转移
    $(“#”+imgID).effect(“转让”,期权,1000,转让后(imgID));
    };
    功能后转移(imgID){
    setTimeout(函数(){
    $(“#picFrame”).html(“”);
    $(“#”+imgID.hide();
    如果((lastImage!=“”)和&(lastImage!=imgID)){
    $(“#”+lastImage).show();
    }
    lastImage=imgID;
    transferInProgress=false;
    }, 1000);
    };
    $(“#gen,#bo”).mouseover(函数(){runTransfer(this.id);返回false;});
    });
    
    您也可以使用.mouse和附加的传输过程代码。是的,优化了一点。谢谢。提琴杰克-一旦你验证了它,请将它标记为答案,谢谢。我试过了,但我必须等2分钟。我会尽快标记的!