3
私は現在、私はModernizr.JSにmatchmedia.jsを置き換えるならば、私の上記のコード作業が意志今MatchMedia.jsはModernizr JSに含まれていますか?
<script src="https://raw.github.com/paulirish/matchMedia.js/master/matchMedia.js"></script>
<!-- <script>
</script>-->
<script>
if (matchMedia('only screen and (min-width : 1025px) and (max-width : 2048px)').matches) {
// smartphone/iphone... maybe run some small-screen related dom scripting?
$(document).ready(function() {
var $body = $('body'); //Cache this for performance
var setBodyScale = function() {
var scaleFactor = 0.5,
scaleSource = $body.width(),
maxScale = 150,
minScale = 10;
var fontSize = scaleSource * scaleFactor; //Multiply the width of the body by the scaling factor:
if (fontSize > maxScale) fontSize = maxScale;
if (fontSize < minScale) fontSize = minScale; //Enforce the minimum and maximums
$('body').css('font-size', fontSize + '%');
}
$(window).resize(function(){
setBodyScale();
});
//Fire it when the page first loads:
setBodyScale();
});
}
</script>
を使用していますか?
:
基本的に、あなたはあなたの行を変更したいです。私は 'matchMedia'を' mq'に置き換える必要があります –
そしてそれはIE9と互換ですか? –
'.matches'も削除する必要がありますか? –