Last active
May 29, 2019 01:43
-
-
Save tetsunosuke/0eab7c293f18d3b3a443165d26f54720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js'></script> | |
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/lity/1.6.6/lity.css' /> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lity/1.6.6/lity.js'></script> | |
</head> | |
<body> | |
<a href="blank.html" target="_blank">blank</a> | |
<a href="http://phi-jp.github.io/phiary-workspace/assets/images/cafe.jpg" data-lity>simple</a> | |
<a href="#">hash</a> | |
<script> | |
$(function() { | |
// ハッシュリンク(#)と別ウィンドウでページを開く場合はスルー | |
$('a:not([href^="#"],[target="_blank"])').on('click', function(e){ | |
// e.preventDefault(); // ナビゲートをキャンセル...しなくても良いはずです | |
console.log("data-lityの効果が発動するはず"); | |
}); | |
/** | |
// ここからは実験のため不要です | |
$("a").on('click', function(e) { | |
// e.preventDefault(); | |
console.log("上の行のpreventDefaultがなければ普通に開く"); | |
}); | |
*/ | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment