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
  • !15798

Allow accordion and non-accordion controls on the same collapsible

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/Nikita240/collapsible-accordion-multiple-controls into master Feb 12, 2015
  • Overview 0
  • Commits 10
  • Pipelines 0
  • Changes 10

Created by: Nikita240

Fixes #15741 (closed).

The setup

Suppose you have collapsible panels. You want to have dual controls for them. That means, 2 separate buttons for collapsing each panel. Now, this would normally work with bootstrap, but you want one set of controls to have accordion like behavior, and the other set of controls to have normal behavior.

image

The problem

The collapsible panels assume the control state of the first button you click. So if you click an accordion button first, the non-accordion button will behave like the accordion button, and vice-versa.

Demo (clone the branch and open test.html)

The cause

Bootstrap creates a new Collapse object for each collapsible panel. The problem is, it creates it once during the first collapse event. This means all the options of the Collapse object stay the same. Because of this, when you trigger another collapse with a different controller, it still "thinks" you triggered it from the old one, because the Collapse objects parameters still point to the old controller.

The solution

Set the $trigger property and recalculate parent during each controller click.

Demo (clone the branch and open test.html)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/Nikita240/collapsible-accordion-multiple-controls