Skip to content

Instantly share code, notes, and snippets.

@nwhobart
Created July 12, 2016 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwhobart/7da1ceda7a00bdb0fa38157515a712ae to your computer and use it in GitHub Desktop.
Save nwhobart/7da1ceda7a00bdb0fa38157515a712ae to your computer and use it in GitHub Desktop.
// Hide on click.
if (config.hideOnClick) {
$this.find('a')
.css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)');
$this
.on('click', 'a', function(event) {
var $a = $(this),
href = $a.attr('href'),
target = $a.attr('target');
if (!href || href == '#' || href == '' || href == '#' + id)
return;
// Cancel original event.
event.preventDefault();
event.stopPropagation();
// Hide panel.
$this._hide();
// Redirect to href.
window.setTimeout(function() {
if (target == '_blank')
window.open(href);
else
window.location.href = href;
}, config.delay + 10);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment