0
내 브라우저 창 크기를 조정 한 후에 내 코드를 Modernizr.mq
안에 실행하고 싶습니다. 다음은 내 코드입니다 :Modernizr.mq가 창 크기 조정 후 작동하지 않습니다.
jQuery(document).ready(function() {
function callResize(){
if (Modernizr.mq('only screen and (min-width: 800px)')==true) {
$(window).scroll(function() {
var value = $(this).scrollTop();
if (value > 150){
$("#logo").fadeOut();
$(".header-container").addClass("small");
$(".stick-menu").css("bottom",24);
$(".signup").addClass("small");
}else{
$("#logo").fadeIn();
$(".header-container").removeClass("small");
$(".stick-menu").css("bottom",35);
$(".signup").removeClass("small");
}
});
$('#wwdTab').responsiveTabs({
startCollapsed: 'true',
collapsible: true,
rotate: false,
animation: 'fade'
});
}
if (Modernizr.mq('only screen and (max-width: 759px)')==true) {
$('#wwdTab').responsiveTabs({
startCollapsed: 'true',
collapsible: true,
rotate: false,
animation: 'slide'
});
}
}
callResize();
$(window).resize(function() {
callResize();
});
});
그러나 위의 코드는 작동하지 않습니다. Modernizr.mq
작업을 보려면 페이지를 새로 고침해야합니다. 아무렇지 않은 생각이라도 있나요?
가능한 중복 (http://stackoverflow.com/questions/16256674/cant-seem-to-get-jquery- 크기 조정 이벤트 - 작업 -에 - modernizr 미디어 쿼리 기능) – mikedidthis
@mikedidthis 나는 그것을 좋아하지 만, 작동하지 않았다 –
[This stripped-down version] (http://cdpn.io/jCdmy) 작동하지 않는'if {...} '(구조체 또는 Modernizr.mq 대신)에서 수행하고있는 작업 일 수 있다고 제안하는 저를 위해 작동합니까? –