Skip to content

Commit

Permalink
refactor: refactorings on handleMiniCartPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustafa Şükrü Kapusuz committed Apr 14, 2021
1 parent 13e69ad commit 8298edc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions assets/js/src/frontend/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,16 @@ function handleSearch() {
*/
function handleMiniCartPosition() {
const item = document.querySelector('.header--row .menu-item-nav-cart');
if (!item) {
if (item === null) {
return;
}

const miniCart = item.querySelector('.nv-nav-cart');

if (miniCart === null) {
return;
if (miniCart !== null) {
miniCart.style.left =
item.getBoundingClientRect().left < 350 ? 0 : null;
}

miniCart.style.left = item.getBoundingClientRect().left < 350 ? 0 : null;
}

window.addEventListener('resize', handleMiniCartPosition);
Expand Down

0 comments on commit 8298edc

Please sign in to comment.