我使用這個腳本來拉從一個Flickr photoset圖片到我的網頁:(這是在被稱爲在我的頁面的頭一個叫flickr2slideshow.js js文件)Jquery SmoothDivScroll不能使用Flickr JSON API - 加載問題?
jQuery(document).ready(function($) {
var apiKey = 'I put my API key here';
var setID = 'I put the set ID here';
var userID = 'I put the user ID here';
$.getJSON('http://api.flickr.com/services/rest/?&method=flickr.photosets.getPhotos&photoset_id=' + setID + '&api_key=' + apiKey + '&user_id=' + userID + '&extras=description&format=json&jsoncallback=?', function(data){
$.each(data.photoset.photo, function(i,item){
var slideimg = '<img src="http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.secret + '.jpg" height="200" />';
var newthumb = $(".scrollableArea").append(slideimg);
});
$("div#makeMeScrollable").smoothDivScroll({
autoScroll: "always" ,
autoScrollDirection: "endlessloopleft",
autoScrollStep: 1,
autoScrollInterval: 15,
visibleHotSpots: ""
});
});
})
上述腳本作品罰款並加載到我的網頁.scrollableArea股利圖像。
問題是我希望這些照片出現在使用jQuery插件腳本SmoothDivScroll的幻燈片中。當我將它用於硬編碼到我的頁面的圖像時,SmoothDivScroll可以正常工作。但是,當通過我的flickr4slideshow.js腳本加載到div中時,Flickr設置圖像將無法與SmoothDivScroll一起使用)。只有Flickr集中的第一張圖片出現,並且不會滾動。
我的猜測是,當SmoothDivScroll腳本運行時,flickr設置圖像仍然在加載。如何讓腳本等待或開始工作,即使Flickr集仍然被加載到div中?
*我確實通過在.scrollableArea div中添加硬編碼圖像並使用Flickr腳本來測試它。發生這種情況時,它會起作用 - 首先顯示html中的硬編碼圖像,然後顯示flickr設置圖像。