Index: trunk/extensions/SemanticForms/skins/collapse-plus.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/SemanticForms/skins/collapse-plus.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 1 | + application/octet-stream |
Index: trunk/extensions/SemanticForms/skins/SF_collapsible.css |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +.sfCollapsibleFieldset legend { |
| 3 | + cursor: pointer; |
| 4 | + padding-left: 20px; |
| 5 | +} |
| 6 | + |
| 7 | +.sfCollapsedFieldset legend { |
| 8 | + background: transparent url(collapse-plus.png) no-repeat center left; |
| 9 | +} |
| 10 | + |
| 11 | +.sfExpandedFieldset legend { |
| 12 | + background: transparent url(collapse-minus.png) no-repeat center left; |
| 13 | +} |
Index: trunk/extensions/SemanticForms/skins/collapse-minus.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/SemanticForms/skins/collapse-minus.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 14 | + application/octet-stream |
Index: trunk/extensions/SemanticForms/libs/SF_collapsible.js |
— | — | @@ -0,0 +1,55 @@ |
| 2 | +/** |
| 3 | + * SF_collapsible.js |
| 4 | + * |
| 5 | + * Allows for collapsible fieldsets. |
| 6 | + * |
| 7 | + * Based on the 'coolfieldset' jQuery plugin: |
| 8 | + * http://w3shaman.com/article/jquery-plugin-collapsible-fieldset |
| 9 | + */ |
| 10 | + |
| 11 | +function sfHideFieldsetContent(obj, options){ |
| 12 | + obj.find('div').slideUp(options.speed); |
| 13 | + obj.removeClass("sfExpandedFieldset"); |
| 14 | + obj.addClass("sfCollapsedFieldset"); |
| 15 | +} |
| 16 | + |
| 17 | +function sfShowFieldsetContent(obj, options){ |
| 18 | + obj.find('div').slideDown(options.speed); |
| 19 | + obj.removeClass("sfCollapsedFieldset"); |
| 20 | + obj.addClass("sfExpandedFieldset"); |
| 21 | +} |
| 22 | + |
| 23 | +jQuery.fn.sfMakeCollapsible = function(options){ |
| 24 | + var setting = { collapsed: true, speed: 'medium' }; |
| 25 | + jQuery.extend(setting, options); |
| 26 | + |
| 27 | + this.each(function(){ |
| 28 | + var fieldset = jQuery(this); |
| 29 | + var legend = fieldset.children('legend'); |
| 30 | + if ( setting.collapsed == true ) { |
| 31 | + legend.toggle( |
| 32 | + function(){ |
| 33 | + sfShowFieldsetContent(fieldset, setting); |
| 34 | + }, |
| 35 | + function(){ |
| 36 | + sfHideFieldsetContent(fieldset, setting); |
| 37 | + } |
| 38 | + ) |
| 39 | + |
| 40 | + sfHideFieldsetContent(fieldset, {animation:false}); |
| 41 | + } else { |
| 42 | + legend.toggle( |
| 43 | + function(){ |
| 44 | + sfHideFieldsetContent(fieldset, setting); |
| 45 | + }, |
| 46 | + function(){ |
| 47 | + sfShowFieldsetContent(fieldset, setting); |
| 48 | + } |
| 49 | + ) |
| 50 | + } |
| 51 | + }); |
| 52 | +} |
| 53 | + |
| 54 | +jQuery(document).ready(function() { |
| 55 | + jQuery('.sfCollapsibleFieldset').sfMakeCollapsible(); |
| 56 | +}); |