Jquery 未定义mqAdjust
我正在尝试使用mqGenie中的mqAdjust。我使用的是firebug,它调用了函数并点击了定义函数的断点,它给了我一个错误,说函数没有定义。请帮助: 脚本调用Jquery 未定义mqAdjust,jquery,responsive-design,Jquery,Responsive Design,我正在尝试使用mqGenie中的mqAdjust。我使用的是firebug,它调用了函数并点击了定义函数的断点,它给了我一个错误,说函数没有定义。请帮助: 脚本调用 $(document).ready(function () { enquire.register(mqAdjust("screen and (max-width:800px)"), function () { console.log("handler 1 matched"); });
$(document).ready(function () {
enquire.register(mqAdjust("screen and (max-width:800px)"), function () {
console.log("handler 1 matched");
});
});
mqGenie
; (function (window, document) {
document.addEventListener('DOMContentLoaded', function () {
window.mqAdjust = function (mediaQuery) {
if (!mqGenie.adjusted)
return mediaQuery;
var mq = mediaQuery.replace(/\d+px/gi, function (c) {
return parseInt(c, 10) + mqGenie.width + 'px';
});
mq = mq.replace(/\d.+?em/gi, function (c) {
return ((parseFloat(c) * mqGenie.fontSize) + mqGenie.width) / mqGenie.fontSize + 'em';
});
return mq;
};
});
})(window, document);
我使用的是jQueryV.1.10.2的最新版本
我正在使用enquire.js
我正在使用mq.genie.js
指向mqGenie和INQUIRE文档的链接
由于mqGenie是纯javascript,它的函数放在不同类型的document.ready(即DOMContentLoaded)中,因此我必须在脚本上移动函数以使其正常工作 将所有函数移出
; (function (window, document) {
})(window, document);
我还移动了DOMContentLoaded中的函数,并将它们放在我的$(document).ready()中
要获取联尼特派团版本的mqGenie,请转到以下链接:
document.addEventListener('DOMContentLoaded', function () {
});