danielstocks / jQuery-Collapse

A lightweight (~1kb) jQuery plugin that enables expanding and collapsing content
http://webcloud.se/jQuery-Collapse/
MIT License
679 stars 153 forks source link

Selectize + Collapse #92

Closed dotmilk closed 7 years ago

dotmilk commented 7 years ago

I've already ran selectize and have 'html' that looks like this

<container #collapse-these>
  <label></label>
  <select hidden by selectize></select>
  <div inserted by selective></div>
  <label></label>
  <select hidden by selectize></select>
  <div inserted by selective></div>
</container>

Is there a way to have a query for the header/summary as well as one for the element to collapse:

As far as i can tell i can only point it to the summary if there is some strange nesting, not at the thing i want to collapse as well. Right now it will collapse the already hidden selects, leaving the divs that had been inserted by selectize visible.

<container #collapse-these>
  <label></label> <-- summary
  <select hidden by selectize></select> <--- should be ignored
  <div inserted by selective></div> <-- needs to collapse
  <label></label> <-- summary
  <select hidden by selectize></select> <---should be ignored
  <div inserted by selective></div> <-- needs to collapse
</container>
dotmilk commented 7 years ago

Or perhaps a way to inform it to ignore things after the summary/header that are already hidden (display: none)?

dotmilk commented 7 years ago

If i change the plugin $details to next next and pass a query like '> :nth-child(3n-2)' then it works like I would expect

    $.extend(this, {
      isOpen : false,
      $summary : $el.attr("data-collapse-summary",""),
        $details : $el.next().next(),
      options: parent.options,
      parent: parent
    })
danielstocks commented 7 years ago

Great, I'm happy that you found a solution!

dotmilk commented 7 years ago

Well i wouldn't consider breaking the plugin for other instances that aren't this case on page a solution.