diff options
author | Arvind Singh <arvind@artificilabs.com> | 2018-11-19 15:19:54 +0300 |
---|---|---|
committer | Arvind Singh <arvind@artificilabs.com> | 2018-11-19 15:19:54 +0300 |
commit | 516debac2abfaaae86387dc64ba799b8a7a3b7f8 (patch) | |
tree | 8c52f1040015a15af11fb3a6d8263bad11c81d2d | |
parent | 6921f12c40dfdbde9185f41f99e752b800c0ffaa (diff) |
fix form submission
-rw-r--r-- | layouts/partials/contact.html | 2 | ||||
-rw-r--r-- | static/js/script.js | 19 |
2 files changed, 7 insertions, 14 deletions
diff --git a/layouts/partials/contact.html b/layouts/partials/contact.html index bb96c89..91fb989 100644 --- a/layouts/partials/contact.html +++ b/layouts/partials/contact.html @@ -55,7 +55,7 @@ </div> <div class="col-12"> - <button class="btn btn-outline-dark">Submit</button> + <button type="submit" class="btn btn-outline-dark">Submit</button> </div> </div> diff --git a/static/js/script.js b/static/js/script.js index 7ee9d02..a745a9b 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -55,19 +55,12 @@ $(document).ready(function(){ }); //Smooth scroll - $("a, button").click(function(event){ - if($(this).attr('type') != 'submit'){ - if(this.hash !== ""){ - event.preventDefault(); - var hash = this.hash; - - $("html, body").animate({ - scrollTop: $(hash).offset().top - }, 800, function(){ - window.location.hash = hash; - }) - } - } + $('a').click(function(){ + var hash = $(this).attr('href').split('#')[1]; + $('html, body').animate({ + scrollTop: $('#' + hash).offset().top + }, 500); + return false; }); |