想要將圖像鏈接到外部鏈接,我會說它是在.wrap中,但似乎無法工作。我檢查了大部分問題,但我嘗試的所有內容都無濟於事。如何將外部鏈接添加到圖片?
var photos = [
{ file: 'image1.png', tag: 'search', href: 'http://www.googl.com'},
{ file: 'image2.png', tag: 'search', href: 'http://www.bing.com'},
{ file: 'image3.png', tag: 'search', href: 'http://www.yahoo.com' }
];
var photoCount = photos.length;
var pageItems = [];
for (var i = 0; i < photoCount; i++) {
if (photos[i].tag != tag && tag != 'all') {
continue;
}
var img = $('<img></img>')
.attr('src', 'static/images/tv/' + photos[i].file)
.addClass('slider-photo');
pageItems.push({item: img,caption: descDiv});
}
「* ...我會說它是在一個.wrap,但似乎無法開始工作... *,」可以你解釋一下自己? – Alexander 2013-02-16 18:23:18
photos [i] .tag!= tag && tag!='all'...所有的項目都會'繼續' – Shanimal 2013-02-16 18:24:46
我認爲你沒有聲明標籤變量.. – sasi 2013-02-16 18:28:59