;(function($) {
$.fn.gnbmenu = function(options) {
options = $.extend({
width:900,
speed: 500,
easing: 'easeOutCubic',
reset: 2000
}, options);
return this.each(function() {
var $nav = $(this),
$nav_gnb = $(this).find('li'),
$gnb_img = $('.gnb_img p'),
$current_item = $(this).find('.focus'),
$index = 0, $focus_index = 0,
$autoheight = $('.intro').outerHeight(),
reset;
$('#container').css('height',$autoheight);
$nav_gnb.bind('mouseover focusin', function() {
$index = $(this).index();
clearTimeout(reset);
$gnb_img.animate({
left: $(this).position().left,
width: $(this).outerWidth()
}, {
duration: options.speed,
easing: options.easing,
queue: false
});
})
.bind('mouseover focusin', function() {
reset = setTimeout(function() {
$gnb_img.animate({
left: $current_item.position().left,
width: $current_item.outerWidth()
}, options.speed);
.bind('mouseover focusin', function() {
reset = setTimeout(function() {
$gnb_img.animate({
left: $current_item.position().left,
width: $current_item.outerWidth()
}, options.speed);
}, options.reset);
})
.click(function(){
$(this)
.siblings().removeClass('focus')
.end().addClass('focus');
$current_item = $(this);
$focus_index = $(this).index();
if($focus_index == 0){
$('#wrap').addClass('none');
}else{
$('#wrap').removeClass('none');
}
$autoheight = $('.contents>div:eq('+ $focus_index +')').outerHeight();
$('#container').stop().animate({'height':$autoheight},options.speed)
$('.contents').stop().animate({'left':- options.width * $focus_index
},options.speed,options.easing);
})
})
.click(function(){
$(this)
.siblings().removeClass('focus')
.end().addClass('focus');
$current_item = $(this);
$focus_index = $(this).index();
if($focus_index == 0){
$('#wrap').addClass('none');
}else{
$('#wrap').removeClass('none');
}
$autoheight = $('.contents>div:eq('+ $focus_index +')').outerHeight();
$('#container').stop().animate({'height':$autoheight},options.speed)
$('.contents').stop().animate({'left':- options.width * $focus_index
},options.speed,options.easing);
})
$('#header h1').click(function(){
clicklink(0);
});
clicklink(0);
});
$('.int>#sol01').click(function(){
clicklink(3);
});
clicklink(3);
});
function clicklink(a){
$('.focus').removeClass('focus');
if(a == 0){
$('#wrap').addClass('none');
}else{
$('#wrap').removeClass('none');
}
$current_item = $nav.find('li:eq(' + a + ')').addClass('focus');
$autoheight = $('.contents>div:eq(' + a + ')').outerHeight();
$('.contents').stop().animate({'left':- options.width * a},options.speed);
$('#container').stop().animate({'height':$autoheight},options.speed);
clearTimeout(reset);
reset = setTimeout(function() {
$gnb_img.animate({
left: $current_item.position().left,
width: $current_item.outerWidth()
}, options.speed);
}, 100);
};
});
}
})(jQuery);
이 쿼리를 해상도가 1024이상일때만 (데스크탑) 실행되게 하려면 어떻게 소스를 수정해야할까요??
댓글 1개
HackYa
11년 전
if statement 만 하나 넣어주시면 되잖아요.
if (screen.width >= 1024) {
메뉴실행
}
아니면 서버쪽에서 (php 에서) 브라우져 agent detect 하셔서 데스크탑인 경우에만 위 jQuery 를 load 하게 하셔도 되고.
if (screen.width >= 1024) {
메뉴실행
}
아니면 서버쪽에서 (php 에서) 브라우져 agent detect 하셔서 데스크탑인 경우에만 위 jQuery 를 load 하게 하셔도 되고.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 230 | 20년 전 | 2038 | ||
| 229 | 20년 전 | 3131 | ||
| 228 | 20년 전 | 3322 | ||
| 227 | 20년 전 | 2384 | ||
| 226 | 20년 전 | 5458 | ||
| 225 | 20년 전 | 2508 | ||
| 224 | 20년 전 | 2953 | ||
| 223 | 20년 전 | 4196 | ||
| 222 | 20년 전 | 2596 | ||
| 221 | 20년 전 | 2278 | ||
| 220 | 20년 전 | 3666 | ||
| 219 | 20년 전 | 2063 | ||
| 218 | 20년 전 | 3552 | ||
| 217 | 20년 전 | 2469 | ||
| 216 | 20년 전 | 2897 | ||
| 215 | 20년 전 | 2205 | ||
| 214 | 20년 전 | 3326 | ||
| 213 | 20년 전 | 2909 | ||
| 212 | 20년 전 | 3040 | ||
| 211 | 20년 전 | 2140 | ||
| 210 | 20년 전 | 1870 | ||
| 209 | 20년 전 | 2334 | ||
| 208 | 20년 전 | 1962 | ||
| 207 | 20년 전 | 1666 | ||
| 206 | 20년 전 | 1849 | ||
| 205 | 20년 전 | 3939 | ||
| 204 | 20년 전 | 1670 | ||
| 203 | 20년 전 | 2002 | ||
| 202 | 20년 전 | 2343 | ||
| 201 | 20년 전 | 1814 | ||
| 200 | 20년 전 | 2943 | ||
| 199 | 20년 전 | 1997 | ||
| 198 | 20년 전 | 2078 | ||
| 197 | 20년 전 | 3642 | ||
| 196 | 20년 전 | 2965 | ||
| 195 | 20년 전 | 2085 | ||
| 194 | 20년 전 | 10230 | ||
| 193 | 20년 전 | 2235 | ||
| 192 | 20년 전 | 1581 | ||
| 191 | 20년 전 | 2653 | ||
| 190 | 20년 전 | 2281 | ||
| 189 | 20년 전 | 1673 | ||
| 188 | 20년 전 | 1464 | ||
| 187 | 20년 전 | 1896 | ||
| 186 | 20년 전 | 1695 | ||
| 185 | 20년 전 | 1730 | ||
| 184 | 20년 전 | 2329 | ||
| 183 | 20년 전 | 1539 | ||
| 182 | 20년 전 | 1473 | ||
| 181 | 20년 전 | 1613 | ||
| 180 | 20년 전 | 2708 | ||
| 179 | 20년 전 | 1787 | ||
| 178 | 20년 전 | 1841 | ||
| 177 | 20년 전 | 1967 | ||
| 176 | 20년 전 | 1793 | ||
| 175 | 20년 전 | 1865 | ||
| 174 | 20년 전 | 1686 | ||
| 173 | 20년 전 | 2054 | ||
| 172 | 20년 전 | 1777 | ||
| 171 | 20년 전 | 2551 | ||
| 170 | 20년 전 | 2257 | ||
| 169 | 20년 전 | 2537 | ||
| 168 | 20년 전 | 1464 | ||
| 167 | 20년 전 | 1564 | ||
| 166 | 20년 전 | 2140 | ||
| 165 | 20년 전 | 1605 | ||
| 164 | 20년 전 | 3749 | ||
| 163 | 20년 전 | 2643 | ||
| 162 | 20년 전 | 2064 | ||
| 161 | 20년 전 | 2769 | ||
| 160 | 20년 전 | 1720 | ||
| 159 | 20년 전 | 1594 | ||
| 158 | 20년 전 | 2543 | ||
| 157 | 20년 전 | 1471 | ||
| 156 | 20년 전 | 1714 | ||
| 155 | 20년 전 | 3222 | ||
| 154 | 20년 전 | 1877 | ||
| 153 | 20년 전 | 1608 | ||
| 152 | 20년 전 | 4935 | ||
| 151 | 20년 전 | 4560 | ||
| 150 | 20년 전 | 3499 | ||
| 149 | 20년 전 | 3770 | ||
| 148 | 20년 전 | 7051 | ||
| 147 | 20년 전 | 3535 | ||
| 146 | 20년 전 | 2602 | ||
| 145 | 20년 전 | 2597 | ||
| 144 | 20년 전 | 7160 | ||
| 143 | 20년 전 | 4583 | ||
| 142 | 20년 전 | 1889 | ||
| 141 | 20년 전 | 3247 | ||
| 140 | 20년 전 | 1945 | ||
| 139 | 20년 전 | 1539 | ||
| 138 | 20년 전 | 2289 | ||
| 137 | 20년 전 | 1769 | ||
| 136 | 20년 전 | 1446 | ||
| 135 | 20년 전 | 1780 | ||
| 134 | 20년 전 | 2959 | ||
| 133 | 20년 전 | 2429 | ||
| 132 | 20년 전 | 1703 | ||
| 131 | 20년 전 | 1629 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기