[英]Function only executes when refresh the page, not on first load
我遇到了這個奇怪的問題,希望有人能夠提供幫助。
var k_img = jQuery('#'+c['id']).parents('.PhotoCommentImage').children('.PhotoCommentImg');
k_img[0].onload = (function() {
//these statements only executes when refresh the page, not on first load.
});
我想做的是在圖像加載完成后執行語句。 奇怪的是,這些語句僅在加載頁面時執行。 如果我們刷新頁面,它將正常工作。
提前致謝。
由於您使用的是jQuery,請嘗試$(k_img[0]).bind('load', function() { // });
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.