Skip to content

Commit

Permalink
Applying pull requests from the master branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrpadin committed May 30, 2017
1 parent 20c5be1 commit 80a0a48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions sfsmallscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
for (var b = 0; b < parent.length; b++){
var
item = parent.eq(b),
path = item.is('a') ? item.attr('href') : '',
path = (item.is('a') && !!item.attr('href')) ? item.attr('href') : '',
// Class names modification.
itemClone = item.clone(),
classes = (options.hyperlinkClasses) ? ((options.excludeClass_hyperlink && itemClone.hasClass(options.excludeClass_hyperlink)) ? itemClone.removeClass(options.excludeClass_hyperlink).attr('class') : itemClone.attr('class')) : '',
Expand All @@ -92,7 +92,7 @@
}
classes = (classes) ? ' class="' + classes + '"' : '';
// <option> has to be disabled if the item is not a link.
disable = item.is('span') || item.attr('href')=='#' ? ' disabled="disabled"' : '',
disable = (path == '') || (path == '#') ? ' disabled="disabled"' : '',
// Crystal clear.
subIndicator = 1 < level ? Array(level).join('-') + ' ' : '';
// Preparing the <option> element.
Expand Down Expand Up @@ -136,7 +136,7 @@
$(this).removeAttr('style').removeClass('sfHover').attr('id', $(this).attr('id') + '-accordion');
});
// Doing the same and making sure all the sub-menus are off-screen (hidden).
accordion.find('ul').removeAttr('style').not('.sf-hidden').addClass('sf-hidden');
accordion.children('ul').removeAttr('style').not('.sf-hidden').addClass('sf-hidden');
// Creating the accordion toggle switch.
var toggle = '<div class="sf-accordion-toggle ' + styleClass + '"><a href="#" id="' + toggleID + '"><span>' + options.title + '</span></a></div>';

Expand Down Expand Up @@ -168,7 +168,7 @@
// If the accordion is already expanded:
// Hiding its expanded sub-menus and then the accordion itself as well.
accordionElement.add(accordionElement.find('li.sf-expanded')).removeClass('sf-expanded')
.end().find('ul').hide()
.end().children('ul').hide()
// This is a bit tricky, it's the same trick that has been in use in the main plugin for some time.
// Basically we'll add a class that keeps the sub-menu off-screen and still visible,
// and make it invisible and removing the class one moment before showing or hiding it.
Expand Down Expand Up @@ -277,8 +277,8 @@
if (options.type == 'accordion'){
$(id + '-toggle').parent('div').remove();
}
// Crystal clear!
$(id).show();
// Remove inline CSS display property; less clear than simply using .show(), but respects stylesheet
$(id).css('display', '');
}

// Return original object to support chaining.
Expand Down
5 changes: 4 additions & 1 deletion sftouchscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
if (item.hasClass('sf-clicked')){
// Depending on the preferred behaviour, either proceed to the URL.
if (options.behaviour == 0){
window.location = item.attr('href');
url = item.attr('href');
if (typeof(url) != 'undefined'){
window.location = url;
}
}
// or collapse the sub-menu.
else if (options.behaviour == 1 || options.behaviour == 2){
Expand Down

0 comments on commit 80a0a48

Please sign in to comment.