วิธีการเช็คว่าทำการโหลดเสร็จรึยัง

ครั้งก่อนหน้านี้ผมเคยแนะนำวิธีการเช็ค iframe ว่าโหลดเสร็จรึยัง ไปทีนึง แต่ว่า วันนี้ผม จะแนะนำ อีกแบบก็คือ การเช็คหลังจากที่เราเพิ่ง แก้ไข attribute บางอย่างลงไป

ใช้งานกับ Iframe

  1. $(‘#myIframe’).attr(’src’, ’somecontent.html’).load(function() {
  2.     alert(‘Iframe Loaded’);
  3. });

ใช้งานกับ Image

  1. $(‘#myImage’).attr(’src’, ‘image.jpg’).load(function() {
  2.     alert(‘Image Loaded’);
  3. });

จบละ สั้นมะ

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

1 Comment »

 
 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>