Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !286

Allow for namespacing of modal (and backdrop) window

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/JeanMertz/master into master Sep 22, 2011
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: JeanMertz

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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/JeanMertz/master