我想創建一個照片庫元素,它有一個播放按鈕和下一個/上一個導航... 我可以通過使用ajax加載來做下一個和上一個...我不想預先加載數據的播放功能..我能想到的唯一方法是使用ajax調用播放功能的計時器...但再次......呼叫將以無限的方式發生,直到人離開...在那裏任何更好的方式,我可以做>>> ???我可以做一個ajax調用來獲取每個的html,並將其放入數組並迭代..如果我該怎麼做呢?>>還是有更好的解決方案?Javascript/Ajax幫助
0
A
回答
0
從1 ajax調用獲取所有圖像url並將其存儲在數組中,並在一段時間內使用javascript動態設置圖像src。但是如果不使用預加載,可能會出現閃爍
0
這是一個簡單的方法。
//Global variable
var imgList;
var imgPntr = 0;
//AJAX function
function getImagesUrl()
{
//Some code here
//On success
return arrayOfUrl;
}
// call this to prepare the images
function prepareImages()
{
var temp = getImagesUrl();
for(var i = 0; i 0) {
imgPntr--;
//Load this image in your gallery
loadImage(imgList[imgPntr]);
} else {
//Either rotate to end or alert the user end or disable prev button
}
}
// Call on press play
function play()
{
// Use setTime out and call showNext() until end
}
相關問題
- 1. 幫助
- 2. 幫助
- 3. 幫助
- 4. 幫助
- 5. 幫助
- 6. 幫助
- 7. 幫助,
- 8. 幫助
- 9. 幫助
- 10. 幫助
- 11. 幫助創建枚舉擴展幫助
- 12. 需要幫助相機API幫助
- 13. 一點點幫助請幫助
- 14. Haskell幫助中的classList幫助
- 15. Python TKinter Threading幫助需要的幫助
- 16. 四人幫 - 定義幫助!
- 17. belongs_to has_many協助幫助
- 18. 流星助手:在幫助
- 19. 幫助包括()
- 20. ListView幫助
- 21. admob android幫助
- 22. XPathNavigator的幫助
- 23. 幫助在JavaScript
- 24. iPhone Picker幫助
- 25. 數組幫助
- 26. 比較幫助
- 27. 幫助C#
- 28. 幫助onblur
- 29. Dropbox API幫助
- 30. GridBagLayout幫助
這是一件我曾想過,但不能準確地去了解,因爲我們有渲染HTML作爲圖像不得不進行調整以不同的尺寸和緩存之前調用不同的servlet圖片網址...無論如何,現在我已經在一段時間間隔之後使用差異方法..ajax請求......無論如何......對於建議夥伴來說...... – 2010-10-28 06:13:26