Просмотр файла main_files/js/main.js

Размер файла: 2.62Kb
  1. /*
  2.  
  3. [Core Script]
  4.  
  5. Project: PopForms - Material Design Modal Forms
  6. Version: 1.1
  7. Author : themelooks.com
  8.  
  9. */
  10.  
  11. (function ($) {
  12. "use strict"; // this function is executed in strict mode
  13. $(document).ready(function () {
  14. /* -------------------------------------------------------------------------*
  15. * FORM VALIDATION
  16. * -------------------------------------------------------------------------*/
  17. var loginForm = $('#loginForm');
  18. if ( loginForm.length ) {
  19. loginForm.validate({
  20. rules: {
  21. loginUsername: "required",
  22. loginPassword: "required"
  23. },
  24. errorPlacement: function (error, element) {
  25. return true;
  26. }
  27. });
  28. }
  29. var signupForm = $('#signupForm');
  30. if ( signupForm.length ) {
  31. signupForm.validate({
  32. rules: {
  33. singupName: "required",
  34. singupUsername: "required",
  35. singupEmail: {
  36. required: true,
  37. email: true
  38. },
  39. singupPassword: "required",
  40. singupPasswordAgain: {
  41. equalTo: "#singupPassword"
  42. }
  43. },
  44. errorPlacement: function (error, element) {
  45. return true;
  46. }
  47. });
  48. }
  49. var forgotForm = $('#forgotForm');
  50. if ( forgotForm.length ) {
  51. forgotForm.validate({
  52. rules: {
  53. forgotEmail: {
  54. required: true,
  55. email: true
  56. }
  57. },
  58. errorPlacement: function (error, element) {
  59. return true;
  60. }
  61. });
  62. }
  63. var subscribeForm = $('#subscribeForm');
  64. if ( subscribeForm.length ) {
  65. subscribeForm.validate({
  66. rules: {
  67. subscribeEmail: {
  68. required: true,
  69. email: true
  70. }
  71. },
  72. errorPlacement: function (error, element) {
  73. return true;
  74. }
  75. });
  76. }
  77. var contactForm = $('#contactForm');
  78. if ( contactForm.length ) {
  79. contactForm.validate({
  80. rules: {
  81. contactName: "required",
  82. contactEmail: {
  83. required: true,
  84. email: true
  85. },
  86. contactSubject: "required",
  87. contactMessage: "required"
  88. },
  89. errorPlacement: function (error, element) {
  90. return true;
  91. }
  92. });
  93. }
  94.  
  95. /* -------------------------------------------------------------------------*
  96. * BACKGROUND IMAGE
  97. * -------------------------------------------------------------------------*/
  98. $('[data-img-src]').each(function () {
  99. var imgValue = $(this).data('img-src');
  100. $(this).css('background-image', 'url(' + imgValue + ')');
  101. });
  102. });
  103. })(jQuery);