Skip to content

Instantly share code, notes, and snippets.

@ryanguill
Created June 4, 2014 14:59
Show Gist options
  • Select an option

  • Save ryanguill/6f249a5dd6c4a4c0c360 to your computer and use it in GitHub Desktop.

Select an option

Save ryanguill/6f249a5dd6c4a4c0c360 to your computer and use it in GitHub Desktop.
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<a href="http://google.com">Google</a><br />
<a href="http://example.com" data-dont-fade="true">Example.com (dont fade)</a>
<script>
$('a').on('click', function(e) {
var t = $(e.target),
href = t.attr('href'),
dontFade = t.data('dont-fade');
if ((dontFade === undefined || dontFade === 'false' ) && href !== undefined) {
e.preventDefault();
$("body").fadeOut("slow", function(){
window.location = href;
});
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment