Navigation Menu

Skip to content

Commit

Permalink
Remove href on collapse-link when JS is disabled
Browse files Browse the repository at this point in the history
When JS is disabled, the collapsible section is always shown open; the
'+' icon is therefore useless, and it does not make sense to turn it
into a hyperlink.

The href attribute has been removed (the existing javascript handles
adding the hyperlink when enabled), and the cursor is set to 'pointer'
via javascript.
  • Loading branch information
dregad committed Oct 27, 2015
1 parent 9674df6 commit 7515016
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/collapse_api.php
Expand Up @@ -134,7 +134,7 @@ function collapse_icon( $p_name, $p_section = '' ) {
$t_id = $p_name. '_closed_link';
}

echo '<a id="', $t_id, '" href="" class="collapse-link"><img src="images/', $t_icon, '" alt="', $t_alt, '" /></a>&#160;';
echo '<a id="', $t_id, '" class="collapse-link"><img src="images/', $t_icon, '" alt="', $t_alt, '" /></a>&#160;';
}

/**
Expand Down
22 changes: 12 additions & 10 deletions javascript/common.js
Expand Up @@ -37,16 +37,18 @@ style_display = 'block';
$(document).ready( function() {
$('.collapse-open').show();
$('.collapse-closed').hide();
$('.collapse-link').click( function(event) {
event.preventDefault();
var id = $(this).attr('id');
var t_pos = id.indexOf('_closed_link' );
if( t_pos == -1 ) {
t_pos = id.indexOf('_open_link' );
}
var t_div = id.substring(0, t_pos );
ToggleDiv( t_div );
});
$('.collapse-link')
.css('cursor', 'pointer')
.click( function(event) {
event.preventDefault();
var id = $(this).attr('id');
var t_pos = id.indexOf('_closed_link' );
if( t_pos == -1 ) {
t_pos = id.indexOf('_open_link' );
}
var t_div = id.substring(0, t_pos );
ToggleDiv( t_div );
});

$('input[type=text].autocomplete').autocomplete({
source: function(request, callback) {
Expand Down

0 comments on commit 7515016

Please sign in to comment.