Sha256: 202a28e20dc84211e904a0efb8dd3694a64e6e7a6e75c1dcc9f074d0086f17b2

Contents?: true

Size: 771 Bytes

Versions: 51

Compression:

Stored size: 771 Bytes

Contents

var RETINA_NS = 'retina';

$.magnificPopup.registerModule(RETINA_NS, {
	options: {
		replaceSrc: function(item) {
			return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
		},
		ratio: 1 // Function or number.  Set to 1 to disable.
	},
	proto: {
		initRetina: function() {
			if(window.devicePixelRatio > 1) {

				var st = mfp.st.retina,
					ratio = st.ratio;

				ratio = !isNaN(ratio) ? ratio : ratio();

				if(ratio > 1) {
					_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
						item.img.css({
							'max-width': item.img[0].naturalWidth / ratio,
							'width': '100%'
						});
					});
					_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
						item.src = st.replaceSrc(item, ratio);
					});
				}
			}

		}
	}
});

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
trestle-0.8.0 vendor/assets/bower_components/trestle/magnific-popup/src/js/retina.js
wrgem-0.0.55 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.54 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.53 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.52 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.51 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.50 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.49 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.48 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.47 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.46 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.45 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.44 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.43 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.42 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.41 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.40 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.39 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.38 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js
wrgem-0.0.37 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/retina.js