zipper / collapsable.js Goto Github PK
View Code? Open in Web Editor NEWVanilla JS plugin for collapsable boxes written in TypeScript.
Home Page: http://zipper.github.io/collapsable.js/
License: MIT License
Vanilla JS plugin for collapsable boxes written in TypeScript.
Home Page: http://zipper.github.io/collapsable.js/
License: MIT License
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();
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.
The goal is to rewrite the whole plugin using vanilla JS only.
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.
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)
.
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).
When collapsableAll
is set to false
and accordion
is set to true
, the items are not collapsed after initialization.
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...
Je potřeba umožnit, aby se plugin dal stáhnout přes bower.
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:
.ca-control
obsahuje/je <a>
procházet nezávisle všechny prvky..ca-control
(je-li třeba) opět procházet nezávisle jednotlivé prvky.When $('.collapsable').collapsable('destroy');
is called, all aria attributes should be removed aswell.
When function .collapsable()
is called on empty jQuery set, there is an JS error in prepareDefaultExpanded
method.
Je potřeba nahrát poslední verzi pluginu. Soubor by se měl jmenovat jquery.collapsable.js
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.