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

Allow for namespacing of modal (and backdrop) window #286

Closed
wants to merge 1 commit into from
Closed

Allow for namespacing of modal (and backdrop) window #286

wants to merge 1 commit into from

Conversation

JeanMertz
Copy link

I made this change for my personal use a few days ago but figured it might be something others would want. Not sure if I implemented it correctly (but I tested it, and it works) as I am far from being a Javascript/jQuery expert.

This commit makes it possible to namespace your modal windows.

The use case for this is a page where you allow for clients to have custom html & css, but also have some static html/css of your own. Not namespacing your own css means that it could be overwritten by accident by the custom code.

I still wanted to use the Bootstrap elements so I simply added a class namespace inside the LESS files by wrapping all the css inside a new block:

.my_custom_namespace {
  ... original bootstrap css here ...
}

This is very easy to do yourself and it works great, except that I can't use the vanilla JS with this because it places elements directly in the body of the page instead of the namespaced element.

With this commit, if you want a different parent element than the document.body, you pass it the parent option.

$("#my_modal").modal
  show: true
  parent: ".my_custom_namespace"
  backdrop: "static"

Now the modal will be positioned inside the element with class: my_custom_namespace on hiding/showing.

If this is any good, and people are interested, perhaps it would be a good idea to port this functionality to the other JS files as well, but I haven't had a chance to check those out yet.

@fat
Copy link
Member

fat commented Sep 22, 2011

Hm... i don't think this use case is common enough to pull into the plugin, thanks though! cheers

@fat fat closed this Sep 22, 2011
daveobriencouk pushed a commit to egocreative/bootstrap that referenced this pull request Nov 18, 2012
daveobriencouk pushed a commit to egocreative/bootstrap that referenced this pull request Nov 18, 2012
DocX pushed a commit to DocX/bootstrap that referenced this pull request Sep 16, 2014
Update $dropdownLinkColorActive in _variables.scss
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

Successfully merging this pull request may close these issues.

2 participants