Widget v 1.2
Widgets are flexible, dragg-, sort-, and collapseable content boxes. Uses the Store Plugin to store positions
Options read more about inline data attributes
option | default | possible values | description | since | info |
---|---|---|---|---|---|
collapsed | false | true | false | defines if the widget is collapsed | 1.0 | gets overwritten by data from the localStorage |
load | null | String | loads 'String' in the content area | 1.0 | |
reload | false | integer | autoreloads the content if load is set. interger is time in seconds | 1.0 | |
removeContent | true | true | false | replace the content with the loading text while the content is loading | 1.0 | |
collapsible | true | true | false | widget can be collapsed and expand | 1.2 | was "collapseable" in 1.1 |
sortable | true | true | false | widget can be dragged around | 1.1 | |
text | texts | required texts | all required texts | 1.0 | |
onDrag | function(){} | function() | callback if the widget starts dragging | 1.0 | |
onDrop | function(){} | function() | callback if the widget is dropped | 1.0 | |
onExpand | function(){} | function() | callback if the widget gets expand | 1.0 | |
onCollapse | function(){} | function() | callback if the widget collapse | 1.0 |
Methods
method name | default | arguments | description | since | info |
---|---|---|---|---|---|
save | saves the current location and collapse status into the localStorage | 1.0 | uses wl_Store | ||
set | key, value | sets the the option 'key' with the value 'value' | 1.0 |
Usage
$(selector).wl_Widgets([options]);
Calling Methods
$(selector).wl_Widgets('method', [,arg [,arg]]);
Markup
<div class="widgets"> <div class="widget" id="id_of_widget"> <h3 class="handle">Heading</h3> <div> [CONTENT] </div> </div> </div>
All widgets must have a unique id or the storage wont work properly
Example
There position get stored with LocalStorage
. You can clear the LocalStorage to restore the defaults (requires page refresh)