这是我的两个媒体查询
@media screen and (min-width:1240px) and (min-height:800px)
@media screen and (min-width:1400px) and (min-height:900px)
我使用Enquire.js来匹配我的媒体查询
enquire
.register("screen and (min-width:1240px) and (min-height:800px)", {
match: function() {
console.log('1240px');
},
unmatch: function() {
console.log('<1240px');
},
})
.register("screen and (min-width:1400px) and (min-height:900px)", {
match: function() {
console.log('1400px');
},
unmatch: function() {
console.log('<1400px');
});
问题是,如果我从screen and (min-width:1400px) and (min-height:900px)
转到screen and (min-width:1240px) and (min-height:800px)
,则equire.js将与screen and (min-width:1240px) and (min-height:800px)
不匹配,这会产生问题。我尝试使用unmatch来解决这个问题,但如果我从screen and (min-width:1400px) and (min-height:900px)
转到小于screen and (min-width:1240px) and (min-height:800px)
的某个条件,它将无法匹配这两个条件。有人有任何解决方案吗?