-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d7a67f
commit 9249d99
Showing
3 changed files
with
39 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
let sidebar = document.querySelector(".sidebar"); | ||
let closeBtn = document.querySelector("#btn"); | ||
let searchBtn = document.querySelector(".bx-search"); | ||
|
||
closeBtn.addEventListener("click", () => { | ||
sidebar.classList.toggle("open"); | ||
menuBtnChange(); //calling the function(optional) | ||
}); | ||
|
||
searchBtn.addEventListener("click", () => { // Sidebar open when you click on the search iocn | ||
sidebar.classList.toggle("open"); | ||
menuBtnChange(); //calling the function(optional) | ||
}); | ||
|
||
// following are the code to change sidebar button(optional) | ||
function menuBtnChange() { | ||
if (sidebar.classList.contains("open")) { | ||
closeBtn.classList.replace("bx-menu", "bx-menu-alt-right"); //replacing the iocns class | ||
} else { | ||
closeBtn.classList.replace("bx-menu-alt-right", "bx-menu"); //replacing the iocns class | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// floating button to the top | ||
$(document).ready(function() { | ||
$(document).scroll(function(){ | ||
if($(this).scrollTop() > 100){ | ||
$("#scroll").fadeIn(); | ||
} else{ | ||
$("#scroll").fadeOut(); | ||
} | ||
}); | ||
$("#scroll").click(function () { | ||
$("html,body").animate({scrollTop:0},600); | ||
return false; | ||
}); | ||
}); |