为什么按f5 和 f12无法起作用?但我编写的其他网页却可以正常使用f5和f12
来源:1-1 事件类型-概览
qq_鸭绿桥第一帅哥_0
2019-02-12 13:04:13
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>a</title> <link rel="stylesheet" type="text/css" href="css/stylea.css"> <script type="text/javascript" src="js/jquery-3.3.1.js"></script> <script type="text/javascript" src="js/script2.js"></script> </head> <body> <!-- <form> <input type="text" name="input" class="formElement"> <textarea class="formElement" name="textarea"></textarea> <input type="submit" value="提交"> </form> --> <span></span> <nav> <a href="#">泸沽湖</a> <a href="#">丽江古城</a> <a href="#">茶马古道</a> <a href="#">就这家·云逸客栈</a> <a href="#">西双版纳</a> <a href="#">云南红酒庄</a> <a href="#">轿子雪山</a> <a href="#">普者黑</a> <a href="#">海埂大坝</a> <a href="#">玉龙湾</a> <a href="#">昆明郊野公园</a> <a href="#">欧洲风琴小镇</a> </nav> <!-- <input type="date"> <textarea></textarea> --> <div> <img src="img/1.jpg"> <img src="img/2.jpg"> <img src="img/3.jpg"> <img src="img/4.jpg"> <img src="img/5.jpg"> <img src="img/6.jpg"> <img src="img/7.jpg"> <img src="img/8.jpg"> <img src="img/9.jpg"> <img src="img/10.jpg"> <img src="img/11.jpg"> <img src="img/12.jpg"> </div> </body> </html> *{ margin: 0; padding: 0; } html, body{ overflow: hidden; height: 100%; width: 100%; background: #93b3c6; } span{ width: 12px; height: 12px; display: block; border-radius: 50%; margin: 30px auto 40px; background: #fff; } nav{ position: relative; margin: 0 auto 40px; width: 78vw; display: flex; justify-content: space-between; } nav:before{ width: 100%; height: 10px; display: block; background: #fff; position: absolute; top: 20px; content: ''; } nav>a{ position: relative; border:2px solid #5395b4; text-decoration: none; font-size: 20px; background: #fff; height: 40px; line-height: 40px; color: #5395b4; } div{ width: 78vw; height: 75vh; overflow: hidden; margin: 0 auto; background: #fff; box-shadow: 0 0 30px 0 rgba(8,1,3,.3); position: relative; } div img{ width: 98%; height: 96%; margin: 0 auto; display: block; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; } $(document).ready(function(){ var index=0; $('a').mouseenter(function(){ index=$(this).index(); swiper(); }); $(document).keydown(function(event){ // console.log(event.keyCode); if (event.keyCode==37) { index=index>0?--index:$('a').length-1; // if(index==0) // { // index=$('a').length-1; // }else // { // index--; // } } else if (event.keyCode==39) { index=index<$('a').length-1?++index:0; // if (index==$('a').length-1) // { // index=0; // } // else // { // index++; // } }else{ return false; } swiper(); }) var swiper=function(){ $('img').eq(index).css({'opacity':'1'}).siblings().css({'opacity':'0'}); } })
1回答
我测试了你的代码,是可以的哦,F12是打开控制台的快捷键,F5是刷新的快捷键,这些都是浏览器的功能,跟网页内容没有关系的,同学你可以重启浏览器再试一下。如果还有问题再继续提问。
如果帮助都了你,欢迎采纳!
相似问题