想要将图像链接到外部链接,我会说它是在.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