简体   繁体   English

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

[英]Adding hyperlinks to a javascript image array

I'm having a problem with a java carousel. 我在使用Java轮播时遇到问题。 The code is working fine on my page, but I want to add hyperlinks to the images, but I'm unsure how to achieve this. 代码在我的页面上运行正常,但是我想向图像添加超链接,但是我不确定如何实现。 I've tried a few things, but its just caused the code to stop working, and the carousel to drop off the page. 我已经尝试了一些方法,但是它只是导致代码停止工作,并且轮播脱离了页面。

As I say, its all working fine, but as soon as I alter the default code, it falters. 就像我说的那样,它一切正常,但是一旦我更改了默认代码,它就会失败。

The code I have so far is: 到目前为止,我的代码是:

<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>

Any help is appreciated.... 任何帮助表示赞赏。

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

Great example. 很好的例子。 Just add a link into the slide text, and use CSS to style it to the width and height 100% of the slide box. 只需在幻灯片文本中添加一个链接,然后使用CSS将其样式设置为幻灯片框的宽度和高度的100%。

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

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