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

addClass doesn't works for modal-backdrop #3965

Closed
bentzys opened this issue Jun 29, 2012 · 6 comments
Closed

addClass doesn't works for modal-backdrop #3965

bentzys opened this issue Jun 29, 2012 · 6 comments

Comments

@bentzys
Copy link

bentzys commented Jun 29, 2012

given:

.my_css_stuff {
background-color: green;
}

$('.modal').addClass('my_css_stuff'); WORKS

$('.modal-backdrop').addClass('my_css_stuff''); DOESN'T WORKS

@richardp-au
Copy link

jsFiddle?

@bentzys
Copy link
Author

bentzys commented Jun 29, 2012

http://jsfiddle.net/bentzy/ntTgX/12/

Please see the css relevant stuff at the bottom of the css pane.

Thanks!

@richardp-au
Copy link

The backdrop isn't appended to the DOM until after the show event has been triggered. Your code would work in the shown event but only if you don't use animation via the fade class (which you aren't using in your fiddle).

Alternatives would be to tweak the JS or override the CSS in the actual stylesheet. Any reason you're not doing it this way?

@bentzys
Copy link
Author

bentzys commented Jun 30, 2012

Thanks for your help. I'm still new at front-end development :-).
I also got help at http://stackoverflow.com/questions/11240108/specific-modal-backdrop-customizing
My new working fiddle:
http://jsfiddle.net/bentzy/ntTgX/14/
Just for the record - the reason I need to this dynamically is that I want at the same page a regular modal (black backdrop) and a customized modal (transparent backdrop).
Thanks.

@bentzys bentzys closed this as completed Jun 30, 2012
@bentzys bentzys reopened this Jun 30, 2012
@bentzys bentzys closed this as completed Jun 30, 2012
@richardp-au
Copy link

If you're using a transparent backdrop to effectively not have a backdrop, there's a simpler solution: set the modal's backdrop option to false (either in JS or a data attribute).

@esr360
Copy link

esr360 commented May 4, 2018

What is the correct solution to show a popup with a customized backdrop, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants