You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,19 @@
1
-
jQuery Cache Image plugin
2
-
==================
3
-
1
+
#jQuery Cache Images plugin
2
+
4
3
Plugin for jQuery that allows for the easy caching of image files in the browsers localstorage. The local storage approach allows the media to persist across sessions, while the browser manages all of the cross-domain privacy protections.
5
4
6
5
## Using the Plugin
7
6
The plugin can be used two ways. It can either be applied to a specific element in the DOM, or you can apply it to a container that will have images within it. Both approached will bind the Cache Image plugin to all future changes that occur to those elements or their children.
8
7
9
-
### Attaching to an Element
8
+
### Attaching to an Element
10
9
`$('img#AnElement').cacheImage();`
11
10
Any selector here works, however it will bind to only existing elements. If you need to have the caching work on future dynamically created elements use the second approach.
12
11
13
-
### Attached to a Parent Container
12
+
### Attached to a Parent Container
14
13
`$('div#AwesomeContainer').cacheImage();`
15
14
This will watch for changes to the parent and all child elements for changes that involve images. The plugin will step in, cache the image into local storage, and reveil the image to the user.
Attempts to cache that image into your clients browser local storage. This can be very helpful if you have an app where you are storying data into webSQL or IndexedDB and want to grab images during an initial sync, but those images might not be needed until later. By caching the images earily you ensure that they would be available along with the other data.
20
19
@@ -34,7 +33,6 @@ cacheImageFetchURL('http://lookatmy.diamonds/mega-stone.jpg'); // Use to pre-ca
34
33
cacheImageDisplay('http://lookatmy.diamonds/mega-stone.jpg'); // Use to insert the base64 encoded image string
35
34
```
36
35
37
-
# Credits and Thanks
38
-
36
+
# Credits and Thanks
39
37
* Based Heavily off of @doomhz plugin [jQueryImageCache](https://github.com/doomhz/jQuery-Image-Cache)
40
38
* Utilizing base64 encoding from @mathias[Encoding XHR image data](http://jsperf.com/encoding-xhr-image-data/33)
0 commit comments