Skip to content

Commit

Permalink
prevent default for non-absolute links in accordion
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbarnes committed Oct 7, 2014
1 parent 1b3a2dd commit b5417a2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion js/barekit.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ Accordion.prototype.onClick = function (e) {
var $target = $(e.target);

if ($target.is('a')) {
e.preventDefault();

//prevent default behaviour on non-absolute links
var href = $target.attr("href");
if (href == "#") {
e.preventDefault();
}

var $content = $target.parent().next('dd');

this.processOptions($target, $content);
}

};

Accordion.prototype.processOptions = function ($target, $content) {
Expand Down
2 changes: 1 addition & 1 deletion js/barekit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/modules/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@ Accordion.prototype.onClick = function (e) {
var $target = $(e.target);

if ($target.is('a')) {
e.preventDefault();

//prevent default behaviour on non-absolute links
var href = $target.attr("href");
if (href == "#") {
e.preventDefault();
}

var $content = $target.parent().next('dd');

this.processOptions($target, $content);
}

};

Accordion.prototype.processOptions = function ($target, $content) {
Expand Down

0 comments on commit b5417a2

Please sign in to comment.