필라멘트 그룹 사이트에서 일어나는 일을 살펴보면, 특정 너비 아래에서 본문이 클래스 nav-menu
을 얻고 크기가 더 큰 경우를 제거 할 수 있음을 알 수 있습니다. 이 의견들은 RWD-nav.js 완료 :
자신의 RWD-nav.css에서 다음
jQuery(function($){
$('.nav-primary')
// test the menu to see if all items fit horizontally
.bind('testfit', function(){
var nav = $(this),
items = nav.find('a');
$('body').removeClass('nav-menu');
// when the nav wraps under the logo, or when options are stacked, display the nav as a menu
if ((nav.offset().top > nav.prev().offset().top) || ($(items[items.length-1]).offset().top > $(items[0]).offset().top)) {
// add a class for scoping menu styles
$('body').addClass('nav-menu');
};
})
// toggle the menu items' visiblity
.find('h3')
.bind('click focus', function(){
$(this).parent().toggleClass('expanded')
});
// ...and update the nav on window events
$(window).bind('load resize orientationchange', function(){
$('.nav-primary').trigger('testfit');
});
});
이는 데 도움이
/* Media queries
------------------------------ */
@media screen and (min-width: 640px) {
.nav-primary,
.nav-primary ul {
float: left;
}
.nav-primary ul {
float: left;
}
.nav-primary li {
float: left;
font-size: 1.5em;
border-bottom: 0;
}
}
@media screen and (min-width: 910px) {
.nav-primary {
float: right;
clear: none;
}
}
폭 희망에 따라 재배치한다!
[트위터 부트 스트랩 탭을 선택 메뉴로 변환] 가능한 복제본 (http://stackoverflow.com/questions/11459392/convert-twitter-bootstrap-tabs-into-a-select-menu) –