Fixed issue with cms help toggles not functioning correctly

This commit is contained in:
UndefinedOffset 2013-02-19 11:38:40 -04:00
parent 29de6431fd
commit b3e40dd0c3

View File

@ -841,16 +841,26 @@ jQuery.noConflict();
* in the href attribute (which doubles as an anchor link to that element). * in the href attribute (which doubles as an anchor link to that element).
*/ */
$('.cms .cms-help-toggle').entwine({ $('.cms .cms-help-toggle').entwine({
ToggleElement: null,
onmatch: function() { onmatch: function() {
this._super(); this._super();
$(this.attr('href')).hide(); var id=this.attr('href');
if(id.indexOf('#')!=0) {
id=id.split('#');
id='#'+id[1];
}
var element = jQuery(id);
$(this).setToggleElement(element);
element.hide();
}, },
onunmatch: function() { onunmatch: function() {
this._super(); this._super();
$(this).setToggleElement(null);
}, },
onclick: function(e) { onclick: function(e) {
$(this.attr('href')).toggle(); $(this).getToggleElement().toggle();
e.preventDefault(); e.preventDefault();
} }
}); });