javascript - css jquery Background fade to black upon clicking button... unknown bugs -
I'm a newbie on this.
I have created a demo here:
But there is something wrong with that code which prevents it from working.
All I want to do
- Clicking on the button will turn black.
- The black background will fail to click on the button again for the second time.
It should be easy to do but I think there are some bugs in the code, thanks for any useful advice!
HTML
& lt; A href = "#" class = "btn btn-default" data-toggle = "active" & gt; Button & lt; / A & gt; & Lt; Div id = "overlay" & gt; & Lt; / Div & gt;
CSS
#overą¤²े {width: 100%; Height: 100%; Opacity: 0; Background: '# 000'; Top: 0; Left: 0; Transition: Opacity .25s; -Mozy-infected: ambiguity .25s; -Wbkit-Infection: Opacity .25s; } .backdrop {Fuzzy: .4! Important; } {/ Code> JS / jQ
$ (document) .ready (function () {function toggle () {$ ('# overlay'). Toggleclass ('Backdrop');} $ ('[data-toggle = "active"]'). Click (toggle);});
Your code works, it's just that you fix your elements and CSS Must do:
& lt; Div id = "overlay" & gt; & Lt; / Div & gt; & Lt ;! - Revert BTN completed order ad - & gt; & Lt; One style = "position: absolute;" Href = "#" class = "btn btn-default" data-toggle = "active" & gt; Button & lt; / A
#overlay {status: absolute; Width: 100%; Height: 100%; Background: # 000; Top: 0; Left: 0; Opacity: 0; Infection: 0.25 S; -Mozy-infected: ambiguity 0.25 s; -Wbkit-Infection: Opacity 0.25 S; } .backdrop {Fuzzy: 0.4! Important; }
Comments
Post a Comment