$(function () { $('.login-box,.reg-box').addclass("active"); canvasbg.init({ loc: { x: window.innerwidth / 2, y: window.innerheight / 3.3 }, }); $("input[name='rememberme']").change(function () { if ($(this).is(':checked')) { $(this).parent(".pwcheck").find(".checkbox_no").removeclass("checkbox_no").addclass("checkbox_yes"); } else { $(this).parent(".pwcheck").find(".checkbox_yes").removeclass("checkbox_yes").addclass("checkbox_no"); } }); function getmargintop() { var winh = $(window).height(); var headerh = $(".login-container").outerheight(); var mtop = (winh - headerh) / 2; $(".login-box").css("margin-top", mtop + "px"); $(document.body).css({ "overflow-y": "hidden" }); } $(window).resize(function () { getmargintop(); }); getmargintop(); });