Skip to content

amirshim/Javascript-and-Coffeescript-Utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A repository for some random Javascript/Coffeescript code that others might find useful.

Cancelable Image Loader (uses jQuery 1.5 - might work with earlier versions)

I needed a way to be able to cancel html5 image loads. When replacing the the src attribute on an image, most browsers don't cancel a previous loading image. This code, creates an iframe to load the image and can stop it by issueing a window.stop() in that iframe to cancel the image load.

To test it, fire up fiddler2, set it to simulate modem speeds and then using this sample jsfiddle repeatedly click on "Load Next" quickly and watch the fiddler2 window to make sure the requests are being canceled.

The code is writen in coffee script, but a compiled javascript version is available here if you need it.

About

Random Code that other people might find useful

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published