Commit 2e24ce3b authored by Vadym Gidulian's avatar Vadym Gidulian

Initial commit

parents
# Load HD
This jQuery plugin will load HD version of content and replace preview.
### Getting started
It should be applied to content which will be replaced by its HD version. The only parameter is an attribute that stores link to HD version:
```
$('img[hd-src]').loadHD('hd-src');
```
After that content will be replaced by its HD version.
### Example
* In HTML:
```
<img src="poster-preview.png" hd-src="poster.png">
```
* In JS:
```
$(function () {
$('img[hd-src]').loadHD('hd-src');
});
```
/**
* Vadym Gidulian, GVIA Group
*/
(function($){$.fn.loadHD=function(a){return this.each(function(){var b=$(this);var c=b.attr(a);var d=new Image();d.src=c;d.onload=function(){b.attr("src",c);};});};}(jQuery));
\ No newline at end of file
/**
* Vadym Gidulian, GVIA Group
*/
(function ($) {
$.fn.loadHD = function (hdSrcAttr) {
return this.each(function () {
var preview = $(this);
var hdSrc = preview.attr(hdSrcAttr);
var image = new Image();
image.src = hdSrc;
image.onload = function () {
preview.attr('src', hdSrc);
};
});
};
}(jQuery));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment