Retina Image support
-
Hello Codepeople!
I disabled my main wordpress theme’s header in calculated fields form page.I only inserted my site logo and some helper images to form with html content.Now i want to make my form images retina supported.
First i tried to do it with html content field;
<div id="logoform"></div> <style> #logoform { background: url("..logofff.png") center center no-repeat; background-size: 143px 114px; } @media all and (-webkit-min-device-pixel-ratio: 1.5), all and (-o-min-device-pixel-ratio: 3 / 2), all and (min--moz-device-pixel-ratio: 1.5), all and (min-device-pixel-ratio: 1.5) { #logoform { background: url("[email protected]") center center no-repeat; background-size: 143px 114px; } } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { #logoform { background: url("[email protected]") center center no-repeat; background-size: 143px 114px; } } @media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi) { #logoform { background: url("[email protected]") center center no-repeat; background-size: 143px 114px; } } </style>
This doesn’t work.Image not seen anymore.
Second i tried to do it jQuery with that code:
<script> jQuery(document).on( 'ready', function isRetinaDisplay() { if (window.matchMedia) { var mq = window.matchMedia('only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)'); return (mq && mq.matches || (window.devicePixelRatio > 1)); } if (window.isRetinaDisplay()) { jQuery('#formlogo').attr('src', '[email protected]'); } else { jQuery('#formlogo').attr('src', '..logofff.png'); } }); </script>
Without success ??
How can i make my form images retina supported.
Thanks in advance.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Retina Image support’ is closed to new replies.