Slide 17
Slide 17 text
function pixity(imgClass, limitSm, limitMd, limitLg) {
// set defaults
if (imgClass === undefined) { imgClass = "pixity"; }
if (limitSm === undefined) { limitSm = 480; }
if (limitMd === undefined) { limitMd = 768; }
if (limitLg === undefined) { limitLg = 960; }
var cw = document.documentElement.clientWidth, domNode = $("." + imgClass);
function imgSm(domNode) {!
domNode.each(function () {!
var $this = $(this);!
$this.attr('src', $this.data('path') + '/' + $this.data('sm'));!
});!
}!
function imgMd(domNode) {!
domNode.each(function () {!
var $this = $(this);!
$this.attr('src', $this.data('path') + '/' + $this.data('md'));!
});!
}!
function imgLg(domNode) {!
domNode.each(function () {!
var $this = $(this);!
$this.attr('src', $this.data('path') + '/' + $this.data('lg'));!
});!
}!
function imgXl(domNode) {!
domNode.each(function () {!
var $this = $(this);!
$this.attr('src', $this.data('path') + '/' + $this.data('xl'));!
});!
}!
!
if (cw <= limitSm) {
imgSm(domNode);
} else if (cw <= limitMd) {
imgMd(domNode);
} else if (cw <= limitLg) {
imgLg(domNode);
} else {
imgXl(domNode);
}
}