美文网首页前端
点击切换class和内容切换

点击切换class和内容切换

作者: 花花0825 | 来源:发表于2018-07-04 10:26 被阅读1次

html:

<div id="tab_LoginSel" class="i_wx"></div>

<div class="loginForm">

<div id="login_Pc"></div>

<div id="login_Wx" class="login_Wx" style="display: none;"></div>

</div>


js:

var qrloginInterval = 1;

    $('#tab_LoginSel').click(function () {

        showLogin(qrloginInterval);

    });

    function showLogin(qrstate) {

        var tabSelObj = $('#tab_LoginSel');

        var typeClass = tabSelObj.attr('class');

        if (qrstate == "1") {

            tabSelObj.removeClass().addClass("i_pc");

            $("#login_Pc").hide();

            $("#login_Wx").show();

            qrloginInterval = 0;

            $("#hfShowQRCode").val(0);

        }

        else {

            tabSelObj.removeClass().addClass("i_wx");

            $("#login_Pc").show();

            $("#login_Wx").hide();

            qrloginInterval = 1;

            $("#hfShowQRCode").val("1");

        }

    }

相关文章

本文标题:点击切换class和内容切换

本文链接:https://www.haomeiwen.com/subject/fnzsuftx.html