使用 HTML5 或 jQuery 增加要点?
我对 HTML 的了解很少,所以这可能是一个非常微不足道的问题。我真的很感激任何帮助!
当我使用 LaTeX Beamer 类创建演示文稿时,有一个非常有用的命令:
\begin{itemize}
\item<x-> Alpha
\item<x-> Beta
\item<x-> Gamma
\end{itemize}
这将创建三个项目符号点,这些项目符号点在单击鼠标或向前/向后箭头后逐渐出现,例如在 Powerpoint 中。
我希望在 .html 文件中为很长的列表(可能超过 50 个项目)提供相同的功能。所以它确实不能在幻灯片环境中工作,而只能在浏览器中向下滚动。
有没有一种简单的方法可以使用 HTMl5 或 jQuery 或其他方式实现此目的?谷歌搜索出现了数以千计的演示工具,我真的不知道从哪里开始。
I have very little HTML knowledge, so this is probably a very trivial question. I would really appreciate any help!
When I'm creating presentations with the LaTeX beamer class there is the very useful command:
\begin{itemize}
\item<x-> Alpha
\item<x-> Beta
\item<x-> Gamma
\end{itemize}
This creates three bullet points that appear incrementally after a mouseclick or forward/backward arrow like in Powerpoint for example.
I would like to have the same function in a .html file for very long lists, maybe more than 50 items. So it really wouldn't work in a slide environment, but only in a browser by scrolling down.
Is there an easy way to achieve this with HTMl5 or jQuery or some other way? Googling throws up thousands of presentation tools, and I don't really know where to begin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 jQuery,您可以将
keypress
事件绑定到窗口,并在每次按下某个键时显示下一个列表项:要仅使用箭头键进行此操作,需要进行一些细微的更改(您需要使用
keydown
而不是keypress
):您的 HTML 列表将如下所示:
默认情况下,列表项需要隐藏,使用类似
li {在 CSS 中显示:无 }
。另请注意,上面的示例不处理显示最后一个元素时的情况 - 在这种情况下您打算发生什么?
这是一个示例小提琴,显示了这个操作(您需要单击“结果”框架来给出它聚焦,然后按任意键触发事件处理程序)。
With jQuery you could bind a
keypress
event to the window, and show the next list item every time a key is pressed:To make this work with only the arrow keys, a slight change is required (you need to use
keydown
instead ofkeypress
):Your HTML list will look something like this:
The list items will need to be hidden by default, using something like
li { display:none }
in your CSS.Also note that the above example does not handle the case when the last element is shown - what were you intending to happen in this case?
Here is an example fiddle showing this in action (you need to click on the "Result" frame to give it focus, then press any key to trigger the event handler).