是否可以有两个文档就绪功能

时间:2013-02-12 00:32:25

标签: jquery

我不得不两次使用文档这是撕掉代码以使菜单工作的唯一方法是有更好的方法来实现它或将来出错的地方是什么?手风琴是手风琴不能正常工作的手风琴手风琴手。没有在html中工作,并且无法将其加载到切换菜单的下方或上方 - 单击div ....

我写错了吗?

$(document).ready(function () {
            $('ol').accordion();
        });



$(document).ready(function() {
// TOGGLE MENU ~ CLICK DIV
    $('div.logo_menu').click(function() {
    $('#logo_menu ul').show('medium');
    return false;
  });

    $('#logo_menu a').click(function() {
    $(this).parents('ul').not('#logo_menu').hide('slow');
    return false;
  });

    $('#logo_menu ul').mouseleave(function() {
    $(this).hide('slow');
  });

// TOGGLE MENU ~ CLICK aHREF
/*
$('a.drop').hover(function(e) {
    $(this).next("div").slideDown('slow');
    console.log('div clicked');
    e.preventDefault();
    return false;
});
    $('li.mainmenudrop').mouseleave(function() {
    $(this).children("div").slideUp('medium');
  });
});*/  

// EXPAND PAGE
    $('.accordionButton').click(function() {
        //NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
        $('.accordionContent').slideToggle(500,'easeInOutQuad');
        //IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
        if($(this).next().is(':hidden') == true) {
            //OPEN THE SLIDE
            $(this).next().slideToggle(500,'easeInOutQuad');
         } 
     });
    $('.accordionContent').hide();

$.extend($.easing,
 {
     easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
    }

    });
//EXPAND PAGE DIV CONTENT SLIDE
$(".tab_item").mouseover(function() {
            var $this = $(this);
            $this.parent().find(".moving_bg").stop().animate({
                left: $this.position()['left']
            }, { duration: 500 });
    });
var TabbedContent = {
    current: {i:null, obj:null},
    init: function() {
        $(".tab_item").click(function() {
            var $this = $(this);
            TabbedContent.slideContent($this);
        });
        TabbedContent.current.i = 0;
        TabbedContent.current.obj = $(".tabslider li").eq(0);
    },
    slideContent: function($obj) {
        var $container = $obj.closest(".tabbed_content");
        var $tabslider = $container.find(".tabslider");
        var i = $obj.index() - 1;
        var $lis = $tabslider.find("li");
        $new = $lis.eq(i);
        if(i === TabbedContent.current.i) {
            return;
        }
        $lis.hide().filter($new.add(TabbedContent.current.obj)).show();
        var margin_1 = (i > TabbedContent.current.i) ? 0 : -$new.width();
        var margin_2 = (i < TabbedContent.current.i) ? 0 : -$new.width();
        $tabslider.stop().css({
            marginLeft: margin_1 + "px"
        }).animate({
            marginLeft: margin_2 + "px"
        }, 800);
        TabbedContent.current.i = i;
        TabbedContent.current.obj = $new;
    }
}
TabbedContent.init();

// BIG BOX SEARCH LEAVE
$(".searchbox").blur(function() {
    var searchbox = this,
        searchbox_val = $.trim( this.value );
    if (searchbox_val.length > 0) {
        $(searchbox).addClass("blur");
        return true;
    } else {
        $(searchbox).removeClass("blur");
        return false;
    }
});

// SELECT BOX LEAVE 
$(".selectlist").blur(function() {
    var selectlist = this,
        selectlist_val = $.trim( this.value );
    if (selectlist_val.length > 0) {
        $(selectlist).addClass("blur");
        return true;
    } else {
        $(selectlist).removeClass("blur");
        return false;
    }
});
/* TEXT AREA EXPAND */
$('#textareae').elastic();
/* END */

});
/* ALERT BOXES AND DIALOGS (Can Use: Name, ClassName = elements + Val.[0]/ Id = element, NO [0].
--------------------------------*/
function check_searchdomain_input() { // ALERT - Domain Search       
    var searchdomain_val = document.getElementById("searchdomain");
    if (searchdomain_val.value.length > 0) {
    return true;
    } else {
    $( "#dialog_domainsearch" ).dialog();
    return false;
    }
}

function check_menudomain_input() { // ALERT -  Menu domain search   
    var menudomain_val = document.getElementById("menudomain");
    if (menudomain_val.value.length > 0) {
    return true;
    } else{
    $( "#dialog_domainsearch" ).dialog();
    return false;
    }
}

function check_login_input() { // ALERT Login - Enter username       
    var login_val = document.getElementsByName("username");
    if (login_val[0].value.length > 0) {
    return true;
    } else {
    $( "#dialog_login" ).dialog();
    return false;
    }
}

1 个答案:

答案 0 :(得分:2)

所以这不起作用?

$(document).ready(function() {
$('ol').accordion();
// TOGGLE MENU ~ CLICK DIV
$('div.logo_menu').click(function() {
$('#logo_menu ul').show('medium');
return false;
//all the rest