I'm new with jquery and I'm having problems in constructing functions. I need some help on this one? I'm not sure I've done the correct thing with this functions?
Please explain what is rong in how I wrote the next functions or tell me how to build the correct syntax The function member.panel.init('login') doesn't do the right thing.
member = {};
member.panel = function(){
return{
init: function(a)
{
$('#log_in .login').click(open_menu(a));
$('#log_in .register').click(open_menu(a));
},
open_menu: function(what)
{
if(what!='login' || what!='register') what='login';
$('#q_login_dialog #menu-'+what+'').addClass("q_dialog_panel_item_active");
if(what=='login')
{
$('.q_dialog_content #dialog-form3').css("display", "none");
$('.q_dialog_content #dialog-form2').css("padding-bottom", "20px");
$(".login-box").fadeIn('fast');
}
if(what=='register')
{
$('.q_dialog_content #dialog-form2').css('display', '');
$('.q_dialog_content #dialog-form3').css("padding-bottom", "20px");
$(".login-box").fadeIn('fast');
}
}
}
}();
$(function () {
member.panel.init('login');
});
$('#log_in .login').click(open_menu(a));should be$('#log_in .login').click(function(){open_menu(a)});FunctionsandWorking with Objects.... your problem is not jQuery related.