Skip to content

Commit

Permalink
Fix error not full url + 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Schoondergang committed Jul 2, 2014
1 parent 850d2dd commit b4940ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metisMenuAutoOpen",
"version": "0.0.2",
"version": "0.0.3",
"authors": [
"Tim Schoondergang <tim.schoondergang@timmit.nl>"
],
Expand Down
19 changes: 11 additions & 8 deletions jquery.metisMenuAutoOpen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var pluginName = "metisMenuAutoOpen",
defaults = {
classToAdd: 'current-page-item',
currentLocation = window.location
currentLocation: window.location
};

function Plugin(element, options) {
Expand All @@ -18,22 +18,25 @@
init: function () {

var $this_element = $(this.element),
$classToAdd = this.settings.classToAdd;
$classToAdd = this.settings.classToAdd,
$currentLocation = this.settings.currentLocation;


var currentLocation = this.settings.currentLocation;


if (!window.location.origin){
window.location.origin = window.location.protocol+"//"+window.location.host;
}
$currentLocation = window.location.origin + $currentLocation;


$this_element.find("li .nav-second-level li a").each(function(){
//var classname = $(this).attr('class');
var url = $(this).prop('href');

if(currentLocation == url){
//alert(currentLocation);
if($currentLocation == url){
$(this).parentsUntil('ul').addClass($classToAdd);
$(this).parentsUntil('.nav-second-level').parent().addClass("in");
$(this).parentsUntil('#side-menu','li:not(.'+$classToAdd+')').addClass("active");
return false;
//ale:rt()'++';
}


Expand Down

0 comments on commit b4940ba

Please sign in to comment.