You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.5 KiB

4 years ago
  1. function showContact() {
  2. $("#contact-popup").fadeIn(500);
  3. $("#main").fadeTo(500, 0.5);
  4. }
  5. function removeContact(){
  6. $("#contact-popup").fadeOut(500);
  7. $("#main").fadeIn(0);
  8. }
  9. (function ($) {
  10. "use strict";
  11. /*==================================================================
  12. [ Validate ]*/
  13. var input = $('.validate-input .input100');
  14. $('.validate-form').on('submit',function(){
  15. var check = true;
  16. for(var i=0; i<input.length; i++) {
  17. if(validate(input[i]) == false){
  18. showValidate(input[i]);
  19. check=false;
  20. }
  21. }
  22. return check;
  23. });
  24. $('.validate-form .input100').each(function(){
  25. $(this).focus(function(){
  26. hideValidate(this);
  27. });
  28. });
  29. function validate (input) {
  30. if($(input).attr('type') == 'email' || $(input).attr('name') == 'email') {
  31. if($(input).val().trim().match(/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{1,5}|[0-9]{1,3})(\]?)$/) == null) {
  32. return false;
  33. }
  34. }
  35. else {
  36. if($(input).val().trim() == ''){
  37. return false;
  38. }
  39. }
  40. }
  41. function showValidate(input) {
  42. var thisAlert = $(input).parent();
  43. $(thisAlert).addClass('alert-validate');
  44. }
  45. function hideValidate(input) {
  46. var thisAlert = $(input).parent();
  47. $(thisAlert).removeClass('alert-validate');
  48. }
  49. })(jQuery);