使图像卷轴中的图像成为可点击的链接

时间:2014-06-20 10:16:26

标签: javascript arrays image

我不是Javascript和作品的专家,所以我只使用我在网上找到的脚本。至于这个连续的图像卷轴代码,我发现它here

事情是,我想添加链接到图像。

<script type="text/javascript">

var firstreel=new reelslideshow({
    wrapperid: "myreel", //ID of blank DIV on page to house Slideshow
    dimensions: [800, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
    imagearray: [
        ["https://dl.dropbox.com/s/f7lt5o64j20143z/Reel-Welcome.png"], //["image_path", "optional_link", "optional_target"]
        ["https://dl.dropbox.com/s/v98on8f0qi6re57/Reel-Secret.png", "suppose i put my desired url here", "_new"]
        //<--no trailing comma after very last image element!
    ],
    displaymode: {type:'auto', pause:5000, cycles:0, pauseonmouseover:true},
    orientation: "h", //Valid values: "h" or "v"
    persist: false, //remember last viewed slide and recall within same session?
    slideduration: 400 //transition duration (milliseconds)
})
</script>

我尝试了第二张图片,当我右键单击它时,选项包括&#34;在新标签中打开链接&#34;看得见。一旦我点击图片,我想要的就是指向链接。

我也尝试用<a>标签包装图片网址,但当然没有工作(我现在必须听起来很有趣和愚蠢,我很抱歉,但我实际上并不知道我在做什么)。

虽然可以吗?先感谢您! :)

编辑:这是预览,向您展示我正在谈论的内容。 http://scarlethowl.blogspot.com/

1 个答案:

答案 0 :(得分:-1)

欢迎使用Stack Overflow ... 你的问题不明确......点击图片时你是否想去网址? 让我们假设图片是:1.jpg 链接是:www.google.com 代码就是这样:

<a href="http://www.google.com"><img src="1.jpg"></a>