0

好的,我在书签中有一个简单的 javascript 函数,可以找到页面上的所有图像,然后在书签中显示它们

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'/>");
            }
        }

我还有一个 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>

谢谢!

4

1 回答 1

0

根据http://jquery.malsup.com/cycle/int2.html

你只需要添加一个 before: 函数

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

function onBefore() { 
    $('#output').html("Scrolling image:<br>" + this.src); 
} 
于 2011-05-16T03:18:03.247 回答