Merge branch 'master' of github.com:gnuboard/g4s

This commit is contained in:
whitedot
2013-03-04 13:46:05 +09:00
2 changed files with 35 additions and 15 deletions

View File

@ -129,11 +129,11 @@ if ($config['cf_include_head']) {
<nav id="gnb">
<script>$('#gnb').addClass('gnb_js');</script>
<h2>홈페이지 메인메뉴</h2>
<ul>
<ul id="gnb_ul">
<?
$sql = " select * from {$g4['group_table']} where gr_show_menu order by gr_order ";
$result = sql_query($sql);
for ($gi=0; $row=sql_fetch_array($result); $gi++) { // gi 는 group index
for ($gi=0; $row=sql_fetch_array($result); $gi++) { // gi 는 group index
?>
<li class="gnb_1depth">
<a href="<?=G4_BBS_URL?>/group.php?gr_id=<?=$row['gr_id']?>"><?=$row['gr_subject']?></a>

View File

@ -38,11 +38,12 @@ $(function(){
});
// 주메뉴
var $gnb = $('.gnb_1depth > a');
var $gnb = $(".gnb_1depth > a");
$gnb.mouseover(function() {
if(mouse_event) {
$('.gnb_1depth').removeClass('gnb_1depth_over gnb_1depth_on');
$(this).parent().addClass('gnb_1depth_over gnb_1depth_on');
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
$(this).parent().addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).parent());
hide_menu = false;
}
});
@ -51,17 +52,18 @@ $(function(){
hide_menu = true;
});
$('.gnb_1depth li').mouseover(function() {
$(".gnb_1depth li").mouseover(function() {
hide_menu = false;
});
$('.gnb_1depth li').mouseout(function() {
$(".gnb_1depth li").mouseout(function() {
hide_menu = true;
});
$gnb.focusin(function() {
$('.gnb_1depth').removeClass('gnb_1depth_over gnb_1depth_on');
$(this).parent().addClass('gnb_1depth_over gnb_1depth_on');
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
$(this).parent().addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).parent());
hide_menu = false;
});
@ -69,29 +71,47 @@ $(function(){
hide_menu = true;
});
$('.gnb_1depth ul a').focusin(function() {
$('.gnb_1depth').removeClass('gnb_1depth_over gnb_1depth_on');
var $gnb_li = $(this).closest('.gnb_1depth').addClass('gnb_1depth_over gnb_1depth_on');
$(".gnb_1depth ul a").focusin(function() {
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
var $gnb_li = $(this).closest(".gnb_1depth").addClass("gnb_1depth_over gnb_1depth_on");
menu_rearrange($(this).closest(".gnb_1depth"));
hide_menu = false;
});
$('.gnb_1depth ul a').focusout(function() {
$(".gnb_1depth ul a").focusout(function() {
hide_menu = true;
});
$(document).click(function() {
if(hide_menu) {
$('.gnb_1depth').removeClass('gnb_1depth_over gnb_1depth_on');
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
}
});
$(document).focusin(function() {
if(hide_menu) {
$('.gnb_1depth').removeClass('gnb_1depth_over gnb_1depth_on');
$(".gnb_1depth").removeClass("gnb_1depth_over gnb_1depth_over2 gnb_1depth_on");
}
});
});
function menu_rearrange(el)
{
var width = $("#gnb_ul").width();
var left = w1 = w2 = 0;
var idx = $(".gnb_1depth").index(el);
for(i=0; i<=idx; i++) {
w1 = $(".gnb_1depth:eq("+i+")").outerWidth();
w2 = $(".gnb_2depth > a:eq("+i+")").outerWidth(true);
if((left + w2) > width) {
el.removeClass("gnb_1depth_over").addClass("gnb_1depth_over2");
}
left += w1;
}
}
</script>
</body>