diff --git a/ATM Card Input/Capture.PNG b/ATM Card Input/Capture.PNG new file mode 100644 index 0000000..5214513 Binary files /dev/null and b/ATM Card Input/Capture.PNG differ diff --git a/ATM Card Input/README.md b/ATM Card Input/README.md new file mode 100644 index 0000000..54c02bb --- /dev/null +++ b/ATM Card Input/README.md @@ -0,0 +1,10 @@ +# ATM Card + +![Project Screenshot](https://github.com/Prasadpoojary/Frontend-Animations/blob/ATMcard/ATM%20Card%20Input/Capture.PNG?raw=true) + +[Prasad Poojary](https://github.com/Prasadpoojary) + +[View Project](https://prasadpoojary.github.io/Frontend-Animations/ATM%20Card%20Input/) + + + diff --git a/ATM Card Input/animation.js b/ATM Card Input/animation.js new file mode 100644 index 0000000..f44a196 --- /dev/null +++ b/ATM Card Input/animation.js @@ -0,0 +1,153 @@ +$(document).ready(function () { + + $(".gw-cn-one").focus(); + + + $(".gw-cn-one").on('input',function(e) + { + + + if($(this).val().length==4) + { + $(".gw-cn-two").focus(); + + } + + }); + + $(".gw-cn-two").on('input',function(e) + { + + + if($(this).val().length==4) + { + $(".gw-cn-three").focus(); + + } + + }); + $(".gw-cn-three").on('input',function(e) + { + + + if($(this).val().length==4) + { + $(".gw-cn-four").focus(); + + } + + }); + + $(".gw-cn-four").on('input',function(e) + { + + + if($(this).val().length==4) + { + $(".gw-ce-date").focus(); + + } + + }); + $(".gw-ce-date").on('input',function(e) + { + if($(this).val().length==1) + { + try + { + if(Number($(this).val())>1) + { + + $(".gw-card-expire label").html("invalid thru").css("color","red"); + } + else + { + + $(".gw-card-expire label").html("valid thru").css("color","#aaa9a9"); + } + + } + catch(error) + { + alert(error); + $(".gw-card-expire label").html("invalid thru").css("color","red"); + } + + } + + if($(this).val().length==2) + { + try + { + if(Number($(this).val()>12)) + { + $(".gw-card-expire label").html("invalid thru").css("color","red"); + } + else + { + $(".gw-card-expire label").html("valid thru").css("color","#aaa9a9"); + $(this).val($(this).val()+"/"); + } + + } + + + catch(error) + { + $(".gw-card-expire label").html("invalid thru").css("color","red"); + } + } + + if($(this).val().length==5) + { + if(Number($(this).val().split("/")[1])<22) // {12,22} + { + $(this).val($(this).val().split("/")[0]+"/"); + $(".gw-card-expire label").html("invalid thru").css("color","red"); + } + else if($(".gw-cn-one").val().length!=4 || $(".gw-cn-two").val().length!=4 || $(".gw-cn-three").val().length!=4 || $(".gw-cn-four").val().length!=4) + { + $(".gw-card-expire label").html("valid thru").css("color","#aaa9a9"); + } + else + { + $(".gw-card-expire label").html("valid thru").css("color","#aaa9a9"); + + setTimeout(function() + { + $(".gw-card").css('transform','rotateY(180deg)'); + $(".gw-card-front").css('display','none'); + $(".gw-card-back").css('display','block'); + $(".gw-card-back div").css('visibility','hidden'); + }, + 100); + setTimeout(function() + { + $(".gw-card-back div").css('visibility','visible'); + $(".gw-cvv input").focus(); + + }, + 500); + } + + + + + } + + }); + + $(".gw-cvv input").on("input",function(){ + if($(this).val().length==3) + { + $("#cardPaymentForm").submit(); + $(".gw-cvv input").blur(); + } + }); + + + + + + +}); \ No newline at end of file diff --git a/ATM Card Input/index.html b/ATM Card Input/index.html new file mode 100644 index 0000000..0627bd3 --- /dev/null +++ b/ATM Card Input/index.html @@ -0,0 +1,74 @@ + + + +
+ + + +