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

Collapsible arrow(caret) is not changing open/close state #1210

Open
Amitesh opened this issue Aug 15, 2021 · 1 comment
Open

Collapsible arrow(caret) is not changing open/close state #1210

Amitesh opened this issue Aug 15, 2021 · 1 comment

Comments

@Amitesh
Copy link

Amitesh commented Aug 15, 2021

In enableCollapsibleOptGroups option, the open/close caret is not changing it's state on the collapse of options below.

In below image we can see the caret state is same in open/close of group options.

Screen Shot 2021-08-15 at 4 28 53 PM

How we can align it with its state?

Thanks

@Amitesh
Copy link
Author

Amitesh commented Aug 15, 2021

I tried the below solution to fix it.

$(document).ready(function() {
  $('#example-enableCollapsibleOptGroups-new').multiselect({
    enableCollapsibleOptGroups: true
  });

  enhanceCollapsibleButton();
});

function enhanceCollapsibleButton() {
  $('#example-enableCollapsibleOptGroups-new').parent()
    .find('.multiselect-container .caret-container')
    .addClass('open');

  $('#example-enableCollapsibleOptGroups-new').parent()
    .find('.multiselect-container .caret-container')
    .click(function() {
      $(this).toggleClass('open close');
    });
}

Styles:

.multiselect-container .caret-container {
  position: relative;
  cursor: pointer;
}

.multiselect-container .caret-container.open,
.multiselect-container .caret-container.close {
  float: none;
  height: initial;
  width: initial;
  font-size: 1rem;
  padding: 0px 8px;
}

.multiselect-container .caret-container::after {
  display: block;
  position: absolute;
  top: 50%;
  right: -4px;
  -webkit-transform: translateY(-50%) rotate(0deg);
  transform: translateY(-50%) rotate(0deg);
  font-size: 1rem;
  transition: transform 0.2s;
}

.multiselect-container .caret-container.close::after {
  -webkit-transform: translateY(-50%) rotate(-90deg);
  transform: translateY(-50%) rotate(-90deg);
}

Stackblitz url - https://stackblitz.com/edit/bootstrap-multiselect-group-example

I hope this will be helpful.

fabian-steinberg added a commit to s-eckard/bootstrap-multiselect that referenced this issue Mar 18, 2022
…roup

- The caret in the group header will now rotate downwards if the group has been uncollapsed and rotate back to its default position to the right otherwise.
- Also changed in this commit is the way the cursor looks when it is hovered over the group header. It is now a pointer to show the user that the whole header is in fact clickable.
fabian-steinberg added a commit to s-eckard/bootstrap-multiselect that referenced this issue Mar 18, 2022
fabian-steinberg added a commit to s-eckard/bootstrap-multiselect that referenced this issue Mar 25, 2022
fabian-steinberg added a commit to s-eckard/bootstrap-multiselect that referenced this issue Mar 25, 2022
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

1 participant