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