Created
December 11, 2012 14:53
-
-
Save nkcmr/4259098 to your computer and use it in GitHub Desktop.
css media query actions in javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queries = [{ | |
'match_this': 'only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5)', | |
'action': function () { | |
$('.post .entry-content img').each(function (index, element) { | |
$(this).attr('width', '100%'); | |
$(this).removeAttr('height'); | |
}); | |
} | |
}, { | |
'match_this': 'only screen and (min-width : 321px)', | |
'action': function () { | |
$('.post .entry-content img').each(function (index, element) { | |
$(this).attr('width', '100%'); | |
$(this).removeAttr('height'); | |
}); | |
} | |
}, { | |
'match_this': 'only screen', | |
'action': function () { | |
console.warn('NO MQ MATCHES: RESORT TO DEFAULT'); | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment