html窗口变为活动状态,通过单击链接更改div的活动状态

我目前在登录框中遇到了一些问题。我使用我自己的版本,逻辑背后的逻辑是tutorial online。现在一切正常。当我点击我的登录按钮时,JQuery触发器显示分配给它的类active的窗口。一旦登录框出现,用户可以在登录框中点击登记,并且注册窗口变为活动状态。我知道我在这里可能有点难,但问题应该相当简单。我想按LOGIN旁边的一个新按钮,将用户直接带到REGISTER。为此,我需要根据我按哪个按钮将active状态设置为不同的形式。我试图制作一个js脚本,用于检测哪个链接已被点击,然后将活动状态设置为该窗体。所以第一个代码是链接,现在他们都在登录阶段打开登录框。但我的目标是让第二个人打开注册阶段。这可能吗?如何在一次点击中将活动状态设置为正确的形式?通过单击链接更改div的活动状态

HTML

login

Reg

的Javascript

$(function() {

//the form wrapper (includes all forms)

var $form_wrapper = $('#login-box'),

//the current form is the one with class active

$currentForm = $form_wrapper.children('form.active'),

//the change form links

$linkform = $form_wrapper.find('.linkform');

$linkform.bind('click', function(e) {

var $link = $(this);

var target = $link.attr('rel');

$currentForm.fadeOut(400, function() {

//remove class active from current form

$currentForm.removeClass('active');

//new current form

$currentForm = $form_wrapper.children('form.' + target);

//animate the wrapper

$form_wrapper.stop()

.animate({

height: $currentForm.data('height') + 'px'

}, 500, function() {

//new form gets class active

$currentForm.addClass('active');

//show the new form

$currentForm.fadeIn(400);

});

});

e.preventDefault();

});

});

+0

你能为此安排一把小提琴 –

+0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值