我有 tumblr 的这段代码,我希望当 .html_photoset fonction 发生时, .onkeyup fonction 不会发生,因为两个 fonction 都使用箭头键!我如何在第二个脚本中添加一个 if 以防止它在第一个脚本打开时发生?
{block:Photoset}
{block:PermalinkPage}
<script type="text/javascript">
$(document).ready(function() {
$('.html_photoset').killPhotoset({
photoSize: 500
});
});
</script>
<!-- [...] -->
{block:PermalinkPagination}
<div class="permpaginate">
{block:NextPost}
<a href="{NextPost}" id="prevp">Previous Project</a>
{/block:NextPost}
{block:PreviousPost}
<a href="{PreviousPost}" id="nextp">Next Project</a>
{/block:PreviousPost}
</div>
{/block:PermalinkPagination}
<script type="text/javascript">
window.onload = function () {
document.onkeyup = function(event) {
var e = (!event) ? window.event : event;
switch (e.keyCode) {
case 37:
window.location.href = document.getElementById('prevp').href;
break;
case 39:
window.location.href = document.getElementById('nextp').href;
break;
}
};
};
</script>
{/block:PermalinkPage}
{/block:Photoset}