यहां कुछ ऐसा जो मैंने संकलित किया है, जो मदद कर सकता है। मैं इसका परीक्षण करने में कामयाब नहीं हो सका अगर आपको कोई समस्या है तो कृपया मुझे बताएं।
$(function() {
var $images = $('img.imageClassUpdateAtInterval:not([src="/assets/spinner.gif"])');
// Now, no such image with
// a spinner
if($images.length === 0 && window.imageLocator)
clearInterval(window.imageLocator);
window.imageLocator = setInterval(function() {
$images.each(function() {
$this = $(this);
if (!$this.data('src')) {
$this.data('src', $this.prop('src'));
}
$this.prop('src', $this.data('src') + '?timestamp=' + new Date().getTime());
console.log($this.prop('src'));
});
}, 60 * 1000);
// suppose, an error occured during
// locating the src (source) of the
// image - image not found, network
// unable to locate the resource etc.
// it will fall in each time on error
// occurred
$('img.imageClassUpdateAtInterval').error(
function() {
// set a broken image
$(this).unbind("error").attr("src", "/assets/broken.gif");
// setting this up in relative
// position
$(this).css("position", "relative");
$(this).apppend("<span>Error occured</span>");
$(this).find("span").css({"position": "absolute", "background-color": "#252525", "padding": ".3em", "bottom": "0"});
});
});
ऊपर समाधान दो अलग @user113716 द्वारा शुरू समाधान और @travis
स्रोत
2012-01-23 08:08:52
यह उत्कृष्ट इनपुट है। धन्यवाद! मुझे अतिरिक्त जानकारी पसंद है। यहां मूल जेएस है जिसका उपयोग मैं हर 60 सेकंड में कक्षा के आधार पर कुछ छवियों को वास्तव में पुनः लोड करने के लिए कर रहा हूं। मैं इस कोड को निम्नलिखित कोड में एकीकृत करने की बहुत सराहना करता हूं ताकि आप इन दो उदाहरणों को सही ढंग से एकीकृत कर सकें (मैं किसी भी महत्वपूर्ण स्तर पर जेएस में काम करने के लिए काफी नया हूं): http: // j। एमपी/wzi7FI – ylluminate
क्षमा करें ylluminate। मैं दूर हो गया मैंने अपनी पोस्ट संपादित की है और मुझे उम्मीद है कि यह आपकी मदद करेगा। –
असली अच्छी तरह से काम किया, धन्यवाद! बनाने के लिए कुछ tweaks है, लेकिन आप इसे काफी अच्छी तरह से मिला है। शानदार नौकरी। – ylluminate