Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/uicardiodev/hugo-uilite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArvind <roadsidegeek@gmail.com>2019-06-19 19:35:20 +0300
committerGitHub <noreply@github.com>2019-06-19 19:35:20 +0300
commit652c4828ec2ae7a3af425f85b38b19aa5bc66b85 (patch)
treeac114c288f51dfc32c053292fa63ccb631f4f721
parent8e97d84a1c23c75aeb4a7e843aaa37e683ff062d (diff)
parenta8fb434c01104c35f097e93f5253ad35deb32e3c (diff)
Merge pull request #9 from arunvelsriram/smooth-scroll
Smooth scroll to contact section
-rw-r--r--static/js/main.js42
1 files changed, 28 insertions, 14 deletions
diff --git a/static/js/main.js b/static/js/main.js
index 41ca242..2f1d09b 100644
--- a/static/js/main.js
+++ b/static/js/main.js
@@ -16,40 +16,54 @@
let menuBtn = $("#menuBar");
-menuBtn.click(function(){
+menuBtn.click(function() {
$('.hamburger-menu').toggleClass('animate');
- if($(".secondaryMenu").hasClass("active")){
-
+ if ($(".secondaryMenu").hasClass("active")) {
+
$(".secondaryMenu").removeClass("active");
- setTimeout(function(){
+ setTimeout(function() {
$(".primaryMenu").addClass("active");
- },400);
+ }, 400);
+
-
} else {
$(".primaryMenu").removeClass("active");
-
- setTimeout(function(){
+
+ setTimeout(function() {
$(".secondaryMenu").addClass("active");
- },350);
+ }, 350);
}
});
-$(document).ready(function(){
+function scrollTo(target) {
+ const top = $(target).offset().top;
+ const duration = 500;
+ const changeHash = function() {
+ location.hash = target
+ };
+ $("html, body").animate({ scrollTop: top }, duration, changeHash);
+}
+
+$(document).ready(function() {
var elements = $(".sidebar > .main-info *");
console.log(elements);
- for(let i = 0; i < elements.length; i++){
- setTimeout(function(){
+ for (let i = 0; i < elements.length; i++) {
+ setTimeout(function() {
$(elements[i].tagName).addClass("bs");
- }, (400 * i) - 90 * i );
+ }, (400 * i) - 90 * i);
}
- setTimeout(function(){
+ setTimeout(function() {
$(".main-content").addClass("active");
}, 1900);
+ $("#sidebar a.btn[href='#contact']").on("click", function (event) {
+ event.preventDefault();
+
+ scrollTo($.attr(this, "href"));
+ });
}); \ No newline at end of file