为什么这不适用于Firefox和Opera?

时间:2011-04-05 00:23:46

标签: jquery firefox joomla opera flickr

因此我正在处理的joomla网站的库部分(www.arrowandbranch.com/joomla/gallery)使用jquery和flickr API。这些网站在IE,Safari和Chrome中运行良好,但在FireFox和Opera中却看不到。具体来说,在FF和Opera中,单击缩略图或专辑的标题不会按原样加载左侧框中的图片。

任何想法,我在这里做错了什么?

1 个答案:

答案 0 :(得分:2)

触发你的javascript的代码是导致问题的原因。

右侧的缩略图有以下标记:

<a onclick=" $(document).ready(function(){ $('#photo2').flickrGallery({ useFlickr: 'true', flickrAPIKey: '2dc6307382340967ed44d0df77f888bf', photosetID: '72157625589504841', useHoverIntent: 'true', useLightBox: 'true'   });  }); " href="#">                      
    <img style="width: 100px; height: 100px;" alt="" src="http://farm6.static.flickr.com/5207/5310233198_7f8f2295ed_s.jpg" class="album-pic">        
</a>

问题来自onclick事件。你告诉它在$(document).ready上执行,这不是你想要的。 $(document).ready在页面首次加载时执行。如果通过单击触发事件,则只需使用onclick而不使用$(document).ready。

<a onclick="$('#photo2').flickrGallery({ useFlickr: 'true', flickrAPIKey: '2dc6307382340967ed44d0df77f888bf', photosetID: '72157625589504841', useHoverIntent: 'true', useLightBox: 'true'  });" href="#">                      
    <img style="width: 100px; height: 100px;" alt="" src="http://farm6.static.flickr.com/5207/5310233198_7f8f2295ed_s.jpg" class="album-pic">        
</a>

会正常工作。

相关问题