我有這個代碼tumblr,我希望當.html_photoset fonction發生時,.onkeyup功能不會發生,因爲這兩個功能使用箭頭鍵! 如何在第二個腳本中添加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}