繁体   English   中英

将超链接添加到javascript图像数组

[英]Adding hyperlinks to a javascript image array

我在使用Java轮播时遇到问题。 代码在我的页面上运行正常,但是我想向图像添加超链接,但是我不确定如何实现。 我已经尝试了一些方法,但是它只是导致代码停止工作,并且轮播脱离了页面。

就像我说的那样,它一切正常,但是一旦我更改了默认代码,它就会失败。

到目前为止,我的代码是:

<script type="text/javascript">

var firstbgcarousel=new bgCarousel({
    wrapperid: 'mybgcarousel', //ID of blank DIV on page to house carousel 
    imagearray: [
        ['autumnpark.jpg', '<h2>Autumn Day</h2>The sun peaks through the trees, a knife that cuts through the chill, crisp air.'], //["image_path", "optional description"]
        ['chime.jpg', '<h2>Wind Chime</h2>The bellweather of the sky, the chime speaks of impending turmoil.'],
        ['girlportrait.jpg', 'The scent of spring invigorates her as she inhales whilst the warm breeze brings a wave of tranquility.'],
        ['redbench.jpg', 'Alone and Lonliness- Peace and Inner Struggle'] //<--no trailing comma after very last image element!
    ],
    displaymode: {type:'auto', pause:3000, cycles:2, stoponclick:false, pauseonmouseover:true},
    navbuttons: ['left.gif', 'right.gif', 'up.gif', 'down.gif'], // path to nav images
    activeslideclass: 'selectedslide', // CSS class that gets added to currently shown DIV slide
    orientation: 'h', //Valid values: "h" or "v"
    persist: true, //remember last viewed slide and recall within same session?
    slideduration: 500 //transition duration (milliseconds)
})

</script>

任何帮助表示赞赏。

在此处查看源代码: http : //home.comcast.net/~jscheuer1/side/bgcarousel/demo_linked.htm

很好的例子。 只需在幻灯片文本中添加一个链接,然后使用CSS将其样式设置为幻灯片框的宽度和高度的100%。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM