Permalink
Browse files

Fixes Issue #80. Props @gregory-hk

  • Loading branch information...
1 parent 2f32a9e commit f6f6fd0d36c1412b619bdedccb06f580887852d5 @chipbennett committed Nov 26, 2012
Showing with 7 additions and 9 deletions.
  1. +7 −9 functions/widgets.php
View
@@ -88,15 +88,13 @@ function oenology_setup_widgets() {
} // function oenology_widget_setup()
function oenology_showhide_widget_content_open() {
- $showhide_id = 'widget-' . mt_rand();
-
- $showhide = '<span class="showhide">';
- $showhide .= 'Click to <span style="color:#5588aa;" onclick="document.getElementById(\'' . $showhide_id . '\').style.display=\'inline\';">view</span> / <span style="color:#5588aa;" onclick="document.getElementById(\'' . $showhide_id . '\').style.display=\'none\';">hide</span>';
- $showhide .= '</span>';
- $showhide .= '<br /><br />';
- $showhide .= '<div id="' . $showhide_id . '" style="display:none;">';
-
- return $showhide;
+ $showhide = '<span class="showhide">';
+ $showhide .= 'Click to ';
+ $showhide .= '<span style="color:#5588aa;" onclick="d=this.parentElement.nextElementSibling; d.style.display==\'none\' ? d.style.display=\'block\' : d.style.display=\'none\';">view/hide</span>';
+ $showhide .= '<br /></span>';
+ $showhide .= '<div>';
+
+ return $showhide;
}
function oenology_showhide_widget_content_close() {

0 comments on commit f6f6fd0

Please sign in to comment.