Sunday, April 2, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home JavaScript

How to blur body when menu is opened? – JavaScript – SitePoint Forums

learningcode_x1mckf by learningcode_x1mckf
September 26, 2022
in JavaScript
0
Time limit for notify – JavaScript – SitePoint Forums
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


You might also like

4 Packages for Working With Date and Time in JavaScript – MUO – MakeUseOf

Understanding the Power of Proxy in JavaScript – hackernoon.com

JavaScript vs. TypeScript: What's the difference? – TheServerSide.com


stark21



August 31, 2022, 12:10pm
#1

Hello all, how are you doing? How you can blur physique when cell menu is opened?
I attempted one thing like this, however that impacts my cell menu I simply need background to be blured not menu.

CSS:

physique.blur > *:not(.menu) 
  filter: blur(5px);
 

menu is only a ul and it’s a sidebar on cell units

JS:

hamburger.addEventListener("click on", () => 
  hamburger.classList.toggle("lively");
  menu.classList.toggle("open");
  physique.classList.toggle("fastened");
  physique.classList.toggle("blur");
);


PaulOB



August 31, 2022, 3:19pm
#2

stark21:

physique.blur > *:not(.menu) 
  filter: blur(5px);

That ought to work if I perceive appropriately.

A really tough demo as simply going out :slight_smile:

1 Like

That’s the consequence I need, however by some means my menu obtained affected with the physique too.


PaulOB



August 31, 2022, 3:36pm
#4

There should be a typo or one thing.

I’m again on the morning when you have a hyperlink or a demo? It ought to be one thing fairly easy.

stark21:

menu just isn’t direct baby of the physique

stark21:

physique.blur > *:not(.menu) {

> = “the direct baby”

You’d have to point out us your HTML to get higher recommendation. We’d have to know the construction of your web page.

2 Likes

Sorry for my English , I’m doing my greatest.

Right here is HTML:


<header id="header">
      <div class="container">
        <div class="row align-items-center">
          <div class="col d-flex align-items-center">
            <div
              class="hamburger d-flex flex-column justify-content-between d-md-none"
            >
              <span></span>
              <span></span>
              <span></span>
            </div>
            <div class="brand">
              <a href="#">
                <img src="img/brand.svg" alt="brand" />
              </a>
            </div>
            <nav id="nav">
              <ul class="menu">
                <li class="menu-item">
                  <a href="#" class="menu-link">Collections</a>
                </li>
                <li class="menu-item">
                  <a href="#" class="menu-link">Males</a>
                </li>
                <li class="menu-item">
                  <a href="#" class="menu-link">Ladies</a>
                </li>
                <li class="menu-item">
                  <a href="#" class="menu-link">About</a>
                </li>
                <li class="menu-item">
                  <a href="#" class="menu-link">Contact</a>
                </li>
              </ul>
            </nav>
          </div>
          <div class="col">
            <div class="float-end">
              <img src="img/icon-cart.svg" alt="cart" class="cart-icon" />
              <img
                src="img/image-avatar.png"
                alt="profile image"
                class="profile-img"
              />
            </div>
          </div>
        </div>
        <hr class="line" />
      </div>
    </header>

And CSS of the physique:

physique 
  font-family: var(--primary-ff);
  min-height: 100vh;
  font-size: 1rem;

You’re doing effective :slight_smile:
For the HTML, stick it right into a code block (put “` on a clean line earlier than it, and the identical on a clean line after it), that’ll format it so we will see.

2 Likes


stark21



August 31, 2022, 4:53pm
#10

So the issue is I can’t seize menu like this and the rationale why background shade labored as an alternative of blur is that I’ve a z-index:111 on menu. When you have any suggestion how might I do it in a different way that will assist quite a bit. Mainly , I wish to blur every part when menu is open besides menu.

do you wish to blur the cart and avatar picture?

nicely, there’s a pair methods to do it… easiest that strikes to my thoughts is to blur every part after which unblur the menu…

physique.blur  filter: blur(5px); 
.menu  filter: none; 

This after all does assume you dont wish to apply another filter kind to the menu at another cut-off date.


stark21



August 31, 2022, 5:54pm
#14

That isn’t working .

physique.blur 
  filter: blur(5px);


physique.blur .menu 
  filter: none;

I can apply background shade however filter none can’t , menu continues to be blured.

Nicely that isnt what i gave you to enter. :wink:

What i imply is… you modified what i instructed you to place in there.

I instructed you this:

m_hutley:

.menu  filter: none; 

You place on this:

stark21:

physique.blur .menu {


stark21



August 31, 2022, 6:00pm
#18

Okay , hear that isn’t working okay? Should you don’t know how you can do it, don’t reply simply ignore this submit. Thanks

At the very least attempt earlier than answering if you wish to assist after all


PaulOB



August 31, 2022, 6:05pm
#19

The css filter is ‘atomic’.

You possibly can’t unblur kids :slight_smile:

If a guardian is blurred then so are all the kids they usually can’t be unblurred.

That’s why in my demo the blurred components and the unblurred components are separate.

Should you can’t extricate the html on your menu from its guardian then the very best you are able to do is shim {a partially} opaque fastened pseudo aspect beneath the menu however above every part else.

I’m out at a restaurant in the intervening time so can’t provide code :slight_smile:

Again tomorrow.

1 Like

Nicely I can’t very a lot say that i’m inclined to assist should you’re going to take that perspective with individuals truly attempting.

As Paul has outlined that the filter is atomic, it’ll must be utilized with extra specificity.

physique.blur > *:not(#header),
physique.blur > #header img 
  filter: blur(5px);

Maybe subsequent time present some persistence.

This code does assume that the header is a direct baby of the physique.

3 Likes


stark21



August 31, 2022, 6:30pm
#21

Really , you possibly can seize menu like this

physique > *:not(.menu) 
  background-color: pink !essential;

The issue is it’ll apply to the menu too as a result of he’s baby of the nav they usually must be seperated I’ll attempt tomorrow it was a protracted day.



Source link

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

4 Packages for Working With Date and Time in JavaScript – MUO – MakeUseOf

by learningcode_x1mckf
April 1, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

4 Packages for Working With Date and Time in JavaScript  MUO - MakeUseOf Source link

Read more

Understanding the Power of Proxy in JavaScript – hackernoon.com

by learningcode_x1mckf
April 1, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Understanding the Power of Proxy in JavaScript  hackernoon.com Source link

Read more

JavaScript vs. TypeScript: What's the difference? – TheServerSide.com

by learningcode_x1mckf
April 1, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

JavaScript vs. TypeScript: What's the difference?  TheServerSide.com Source link

Read more

JetBrains updates IDEs for Java, JavaScript, Ruby – InfoWorld

by learningcode_x1mckf
March 31, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

JetBrains updates IDEs for Java, JavaScript, Ruby  InfoWorld Source link

Read more

Virtru Announces First Ever FIPS 140-2 Validated JavaScript … – GlobeNewswire

by learningcode_x1mckf
March 30, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Virtru Announces First Ever FIPS 140-2 Validated JavaScript ...  GlobeNewswire Source link

Read more
Next Post
How to Add Python to PATH – Real Python

How to Add Python to PATH – Real Python

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Why Google Chrome is Hanging to C++ Memory when it can Go for … – Analytics Insight

February 25, 2023
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Developers Warned of Critical Remote Code Execution Flaw in Quarkus Java Framework – SecurityWeek

March 5, 2023
COBOL programming skills gap thwarts modernization to Java

COBOL programming skills gap thwarts modernization to Java

January 22, 2023

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • So why did they decide to call it Java? – InfoWorld
  • Senior Java Developer – IT-Online
  • 4 Packages for Working With Date and Time in JavaScript – MUO – MakeUseOf

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?