Advertisement
Guest User

Untitled

a guest
Sep 5th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1.  
  2.  
  3.  
  4. $(document).ready(function(){
  5.  
  6. /*div居中*/
  7. function landCenter(){
  8. var land= $('.land_content');
  9. land.css({
  10. "left": ($(window).width() - land.outerWidth())/2,
  11. "top": ($(window).height() - land.outerHeight())/2 - 20
  12. });
  13.  
  14. };
  15. $(function(){landCenter()});
  16. $(window).resize(function(){landCenter()});
  17. /*div居中 end*/
  18.  
  19. //淡出
  20. $("#land_bg1").fadeOut(500);
  21. })
  22.  
  23.  
  24. /*背景提示文字*/
  25. function backCheck(){
  26. var u = document.getElementById('user_input1') ;
  27. var p = document.getElementById('psod_input1') ;
  28.  
  29. if (u.value !=''){
  30. u.parentNode.style.backgroundPosition="0px -108px";
  31. u.style.backgroundPosition="0px -108px";
  32. }
  33. if (p.value !=''){
  34. p.parentNode.style.backgroundPosition="0px -108px";
  35. p.style.backgroundPosition="0px -108px";
  36. }
  37. };
  38.  
  39. var secs =5; //次数
  40. function backCount(){
  41. for(var i=secs;i>=0;i--){window.setTimeout('backCheck()', 1000); }
  42. };
  43.  
  44. window.onload=function()
  45. {
  46. backCheck();
  47. backCount();
  48. };
  49.  
  50.  
  51. function input01_onfocus(t){
  52. t.parentNode.style.backgroundPosition="0px -54px";
  53. t.style.backgroundPosition="0px -54px";
  54.  
  55. }
  56. function input01_onblur(s){
  57. s.parentNode.style.backgroundPosition="0px -108px";
  58. s.style.backgroundPosition="0px -108px";
  59. if (s.value ==''){
  60. s.style.backgroundPosition="0px 0px";
  61. s.parentNode.style.backgroundPosition="0px 0px";
  62. }
  63. }
  64. /*背景提示文字 end*/
  65.  
  66.  
  67. /*验证*/
  68. $(document).ready(function(){
  69.  
  70. $('.submit_land').click(function(){
  71. if(! $("#land_shake").is(":animated")){
  72. landVerify();
  73. }
  74. });
  75.  
  76. $("#user_input1,#psod_input1").bind('keyup',function(event) {
  77. if(event.keyCode==13){
  78. if(! $("#land_shake").is(":animated")){
  79. if($("#psod_input1").val()!='' && $("#psod_input1").val()!=''){
  80. landVerify();
  81. }
  82. }
  83. }
  84. });
  85.  
  86. });
  87. var n=0;
  88. var hideTimerO;
  89. function landVerify(){
  90.  
  91.  
  92.  
  93.  
  94. //输入框
  95. var user = $("#user_input1").val();
  96. var pass = encodeURIComponent($("#psod_input1").val());
  97.  
  98. $.ajax(
  99. {
  100. url: "/login/x",
  101. type: "POST",
  102. data:"user="+user+"&pass="+pass,
  103. dataType: 'json',
  104. async:false,//取消异步请求
  105. success: function(json) {
  106. if(json.recode=='0'){
  107. top.location='/index';
  108. }else{
  109. $("#txt").text(json.error);
  110. //输入0次
  111. n+=1;
  112. if( n >=0){
  113. $(".land_prompt_error").css({'height':'50px'}).animate({top:'+'+80+'px',opacity: 1},800, 'easeOutBounce');
  114. clearTimeout(hideTimerO);
  115. hideTimerO = setTimeout(function(){
  116. $(".land_prompt_error").animate({opacity: 0},800,function(){$(".land_prompt_error").css({'top':'-50px','height':'0'})});
  117. },2600);
  118.  
  119. };
  120. flash('#land_shake',15,4,70);
  121.  
  122. return false;
  123. }
  124. }
  125. });
  126.  
  127.  
  128.  
  129.  
  130.  
  131. };
  132. var down_time=0;
  133. $(function(){
  134. $('.land_logo').mousedown(function(){
  135. down_time=new Date().getTime();
  136. });
  137.  
  138. $('.land_logo').mouseup(function(){
  139. up_time = new Date().getTime();
  140. if(up_time-down_time>2000){
  141. if($('#particles').is(':hidden')){
  142. $('#particles').particleground({dotColor: '#5cbdaa',lineColor: '#5cbdaa'});
  143. $('.intro').css({'margin-top': -($('.intro').height() / 2)})
  144. $('#particles').show();
  145. }else{
  146. location.href=location.href;
  147. }
  148. }
  149. });
  150.  
  151. });
  152.  
  153. /*验证 end*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement