我在这里有一个名为的按钮.togglePL,并对其进行了编码以展开或折叠 中的页面选择器#pageList。我想使用键盘元素展开或折叠页面选择器,而alt + p无需单击按钮本身。我尝试过研究如何通过在线 JS 和此处的问题来做到这一点,但没有成功。请查找随附的代码,任何帮助将不胜感激。谢谢。
// Toggle Page List
$(document).ready(function() {
$('.togglePL').click(function(e) {
if ($('#pageList').width() == 40) {
$('.textPL').show();
$('#pageList').width(168);
$('.togglePL').css({left:'192px', transform: 'none'});
$('#pageList a').css({fontSize:'10pt'});
}
else {
$('.textPL').hide();
$('#pageList').width(40);
$('.togglePL').css({left:'64px', transform: 'rotate(180deg)', transitionDuration:'0.3s'});
$('#pageList a').css({fontSize:'14pt'});
}
});
});
<!doctype html>
<!--
~ Copyright (c) Summit Learning Management System (made by students, for students). 2020.
-->
<html><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
<title>Welcome - Summit</title>
<script src="https://kit.fontawesome.com/bec3ffe91b.js" crossorigin="anonymous"></script> <!-- External Font Stylesheet -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <!-- External JQuery Script -->
<link rel="stylesheet" type="text/css" href="../CSS/setting.css"> <!-- Internal Stylesheet -->
<link rel="stylesheet" type="text/css" href="../CSS/styling.css"> <!-- Internal Stylesheet -->
<link rel="shortcut icon" href="#"> <!-- Favicon -->
</head>
<body>
万千封印
相关分类