Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/385.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
Javascript-为输入值选择正确的图像_Javascript_Jquery_Jquery Cycle - Fatal编程技术网

Javascript-为输入值选择正确的图像

Javascript-为输入值选择正确的图像,javascript,jquery,jquery-cycle,Javascript,Jquery,Jquery Cycle,好的,我在bookmarklet中有一个简单的javascript函数,它查找页面上的所有图像,然后在bookmarklet中显示它们 for(var i=0; i<img_find.length; i++) { if (theImg[i].width > 200 && theImg[i].height > 200) { $("#image").append("<

好的,我在bookmarklet中有一个简单的javascript函数,它查找页面上的所有图像,然后在bookmarklet中显示它们

for(var i=0; i<img_find.length; i++)
        {
            if (theImg[i].width > 200 && theImg[i].height > 200)
            {
                $("#image").append("<img id='photo' height='150' src='"+img_find[i]+"'/>");
                $("#width").append("<input type='hidden' value='"+img_find[i]+"' name='story_img'/>");
            }
        }
for(var i=0;i”);
$(“#宽度”)。追加(“”);
}
}
我还有一个jquery幻灯片,你可以点击下一步滚动浏览图片

有没有办法让用户在幻灯片上看到的当前图像成为我输入值中的图像

$('.slideshow').cycle({ 
        prev:   '#prev', 
        next:   '#next', 
        timeout: 0 
    });

<div id='image' class='slideshow' align='left'></div>
<a href='#' id='prev' style='font-size:10px;'>Previous</a>
<a href='#' id='next' style='font-size:10px;'>Next</a>
$('.slideshow')。循环({
上一页:“#上一页”,
下一个:“#下一个”,
超时:0
});
谢谢!

根据

您只需添加一个before:函数

$('.slideshow').cycle({ 
        prev:   '#prev', 
        next:   '#next', 
        before:  onBefore
        timeout: 0 
    });

function onBefore() { 
    $('#output').html("Scrolling image:<br>" + this.src); 
} 
$('.slideshow')。循环({
上一页:“#上一页”,
下一个:“#下一个”,
之前:onBefore
超时:0
});
函数onBefore(){
$('#output').html(“滚动图像:
”+this.src); }