Skip to content

Instantly share code, notes, and snippets.

@wudaown
Created September 5, 2016 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wudaown/aa789adf9cba032e06634712d7f059f6 to your computer and use it in GitHub Desktop.
Save wudaown/aa789adf9cba032e06634712d7f059f6 to your computer and use it in GitHub Desktop.
ikuai_login
$(document).ready(function(){
/*div居中*/
function landCenter(){
var land= $('.land_content');
land.css({
"left": ($(window).width() - land.outerWidth())/2,
"top": ($(window).height() - land.outerHeight())/2 - 20
});
};
$(function(){landCenter()});
$(window).resize(function(){landCenter()});
/*div居中 end*/
//淡出
$("#land_bg1").fadeOut(500);
})
/*背景提示文字*/
function backCheck(){
var u = document.getElementById('user_input1') ;
var p = document.getElementById('psod_input1') ;
if (u.value !=''){
u.parentNode.style.backgroundPosition="0px -108px";
u.style.backgroundPosition="0px -108px";
}
if (p.value !=''){
p.parentNode.style.backgroundPosition="0px -108px";
p.style.backgroundPosition="0px -108px";
}
};
var secs =5; //次数
function backCount(){
for(var i=secs;i>=0;i--){window.setTimeout('backCheck()', 1000); }
};
window.onload=function()
{
backCheck();
backCount();
};
function input01_onfocus(t){
t.parentNode.style.backgroundPosition="0px -54px";
t.style.backgroundPosition="0px -54px";
}
function input01_onblur(s){
s.parentNode.style.backgroundPosition="0px -108px";
s.style.backgroundPosition="0px -108px";
if (s.value ==''){
s.style.backgroundPosition="0px 0px";
s.parentNode.style.backgroundPosition="0px 0px";
}
}
/*背景提示文字 end*/
/*验证*/
$(document).ready(function(){
$('.submit_land').click(function(){
if(! $("#land_shake").is(":animated")){
landVerify();
}
});
$("#user_input1,#psod_input1").bind('keyup',function(event) {
if(event.keyCode==13){
if(! $("#land_shake").is(":animated")){
if($("#psod_input1").val()!='' && $("#psod_input1").val()!=''){
landVerify();
}
}
}
});
});
var n=0;
var hideTimerO;
function landVerify(){
//输入框
var user = $("#user_input1").val();
var pass = encodeURIComponent($("#psod_input1").val());
$.ajax(
{
url: "/login/x",
type: "POST",
data:"user="+user+"&pass="+pass,
dataType: 'json',
async:false,//取消异步请求
success: function(json) {
if(json.recode=='0'){
top.location='/index';
}else{
$("#txt").text(json.error);
//输入0次
n+=1;
if( n >=0){
$(".land_prompt_error").css({'height':'50px'}).animate({top:'+'+80+'px',opacity: 1},800, 'easeOutBounce');
clearTimeout(hideTimerO);
hideTimerO = setTimeout(function(){
$(".land_prompt_error").animate({opacity: 0},800,function(){$(".land_prompt_error").css({'top':'-50px','height':'0'})});
},2600);
};
flash('#land_shake',15,4,70);
return false;
}
}
});
};
var down_time=0;
$(function(){
$('.land_logo').mousedown(function(){
down_time=new Date().getTime();
});
$('.land_logo').mouseup(function(){
up_time = new Date().getTime();
if(up_time-down_time>2000){
if($('#particles').is(':hidden')){
$('#particles').particleground({dotColor: '#5cbdaa',lineColor: '#5cbdaa'});
$('.intro').css({'margin-top': -($('.intro').height() / 2)})
$('#particles').show();
}else{
location.href=location.href;
}
}
});
});
/*验证 end*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment