Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new feature added. #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 44 additions & 7 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
const elementToggleFunc = function (elem) { elem.classList.toggle("active"); }


// // sidebar variables
// const sidebar = document.querySelector("[data-sidebar]");
// const sidebarBtn = document.querySelector("[data-sidebar-btn]");

// sidebar variables
const sidebar = document.querySelector("[data-sidebar]");
const sidebarBtn = document.querySelector("[data-sidebar-btn]");

// sidebar toggle functionality for mobile
sidebarBtn.addEventListener("click", function () { elementToggleFunc(sidebar); });
// // sidebar toggle functionality for mobile
// sidebarBtn.addEventListener("click", function () { elementToggleFunc(sidebar); });



Expand Down Expand Up @@ -136,6 +135,8 @@ for (let i = 0; i < formInputs.length; i++) {





// page navigation variables
const navigationLinks = document.querySelectorAll("[data-nav-link]");
const pages = document.querySelectorAll("[data-page]");
Expand All @@ -156,4 +157,40 @@ for (let i = 0; i < navigationLinks.length; i++) {
}

});
}
}






//Added later on - Hide the show contacts button when the screen size is less than 1250px,
// instead added contacts to expand when the user hovers over the profile card which seems much better.




const elementAddFunc = function (elem) { elem.classList.add("active"); }
const elementRemoveFunc = function (elem) { elem.classList.remove("active"); }


const _sidebar = document.querySelector("[data-sidebar]");
var sidebarInfo = document.querySelectorAll(".sidebar-info");
for(let i=0;i<sidebarInfo.length;i++){
sidebarInfo[i].addEventListener("mouseover",function(){
console.log("mouseover");
//To make sure the side screen got active when it is horizontally aligned
if(window.innerWidth<=1250){
elementAddFunc(_sidebar);
}
})

sidebarInfo[i].addEventListener("mouseout",function(){
console.log("mouseout");

//To make sure the side screen got active when it is horizontally aligned
if(window.innerWidth<=1250){
elementRemoveFunc(_sidebar);
}
})
}
8 changes: 2 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ <h1 class="name" title="Richard hanrick">Richard hanrick</h1>
<p class="title">Web developer</p>
</div>

<button class="info_more-btn" data-sidebar-btn>
<span>Show Contacts</span>

<ion-icon name="chevron-down"></ion-icon>
</button>


</div>

Expand Down Expand Up @@ -1198,4 +1194,4 @@ <h3 class="h3 form-title">Contact Form</h3>

</body>

</html>
</html>