Coder Social home page Coder Social logo

zipper / collapsable.js Goto Github PK

View Code? Open in Web Editor NEW
4.0 14.0 0.0 490 KB

Vanilla JS plugin for collapsable boxes written in TypeScript.

Home Page: http://zipper.github.io/collapsable.js/

License: MIT License

JavaScript 11.61% TypeScript 88.39%
collapsable collapsible vanilla-js

collapsable.js's People

Contributors

milanpala avatar zipper avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

collapsable.js's Issues

Expose function for single box collapsing/expanding

Currently, it is possible to collapse or expand all boxes of set, using call .collapsable('expandAll') or .collapsable('collapseAll'). There should be an option to collapse or expand single box of set, when called on it, eg.

$('.foo, .bar').collapsable();
$('.foo').collapsable('expandAll'); // should expand both boxes
$('.bar').collapsable('collapse'); // should collapse just .bar

// current workaround
$('.bar').data('collapsable').collapse();

External links and multiple initializations of Collapsable

When Collapsable is initialized more then once on a page and there is some external link, there is an error thrown into the console "Error: Collapsable: External link has no associated collapsable item." as a result of some instances not being able to recognize the extenal link. This should not happen.

How can I use predefined events triggered by plugin itself?

How can I use your plugin predefined events?

I want to add a div with special font awesome character (like fa-chevron-down) after box title when collapsed (collapsed state) and
remove that character and replace it with new character (like fa-chevron-up) as box title when expended and I don't want to use css in this case.

I try below code but it seems that something is wrong

$('.collapsable a.ca-link').on('collapsed.collapsable', function(e) {
      $(this).append( "<span class='fa fa-chevron-down'></span>" );
  });
  
$('.collapsable a.ca-link').off('expanded.collapsable', function(e) {
      $(this).append( "<span class='fa fa-chevron-up'></span>" );
  });

I'm beginner in jQuery and not an expert, So please try to give a detailed answer with example or introduce any reference as I don't know anything about Plugins events and some other expressions.
Thanks.

Posibility of changing options after initialization

It is possible to change options of collapsable on the fly, after initialization. However, it is quite complicated to do so (eg. $('.collapsable').data('collapsable').parent.opts.OPT_NAME = OPT_VALUE). It should be possible to change options via calling $('.collapsable').collapsable('option', OPT_NAME, OPT_VALUE).

JS error when url end with #

If there is no hash in url, but the # is contained, there is an jQuery error with jQuery version 3.1 (tested, may be in lower versions as well; in 1.12 it was ok).

Support of jQuery v2

When using collapsable plugin on jQuery version 2.2.x following fatal throwed:
Error: Syntax error, unrecognized expression: [href=#undefined] ...value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized exp...

Bower

Je potřeba umožnit, aby se plugin dal stáhnout přes bower.

Umožnit rozdílnou html strukturu pro více control v rámci jednoho collapsable

Nyní je nutné, aby všechny control prvky, které jsou pro jeden konkrétní collapsable, měly stejnou html strukturu, respektive buď aby všechny .ca-control byly <a> nebo aby jej všechny obsahovaly. Nelze kombinovat. Je potřeba udělat:

  • Při kontrolování, zda .ca-control obsahuje/je <a> procházet nezávisle všechny prvky.
  • Při vytváření odkazu uvnitř .ca-control (je-li třeba) opět procházet nezávisle jednotlivé prvky.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.