I’m just starting to learn jQuery and I’m not sure how to enable a background effect similar to a lightbox.
I want my <div> (registration wizard) to appear at 100% opacity and I’d like everything else behind it to be somewhere around 50% opacity and non-clickable.
How can I achieve this using jQuery?
This is how:
DEMO
You may put above code in a function and call it whenever you need that overlay. To remove it when you don’t need it, you would do:
FYI, you can also put above styles in CSS in a class and then use jQuery’s
addClasstobodywhenever you need it andremoveClasswhen you want to remove it.