Jquery onload/text效果后期反应
Jquery onload/text effect late reaction
在我的rails应用程序中有以下代码:
window.onload = ->
$("#mycontainer").typewriter()
$("#div1").fadeIn("slow")
作用于此:
<blockquote class="pull-left">
<p id="mycontainer">A mathematician, scientist, and engineer are each asked: "Suppose we define a horse's tail to be a leg. How many legs does a horse have?" The mathematician answers "5"; the scientist "1"; and the engineer says "But you can't do that! </p>
<small id="author">Emmanuel Mensah </small>
</blockquote>
现在,我可以清楚地看到window.onload
函数,我理解它可以让jquery在页面加载后立即启动。我意识到,首先,页面加载,然后在一瞬间,我可以在文本效果出现之前看到(整个)文本(效果是打字,这意味着文本不应该是可见的,而是一个键接一个键地键入……向右)。但我想知道如何做到这一点,这样当页面加载时,我根本看不到文本,而是在jquery
启动后。
我尝试将此CSS
style: display:none
添加到<p>
标记中,但这没有任何更改。有人能帮我吗?
首先需要隐藏它们才能看到显示效果。
window.onload = ->
$("#mycontainer").hide()
$("#div1").hide()
$("#mycontainer").typewriter()
$("#div1").fadeIn("slow")
改为尝试body onload。
<body onload="myfunction()">
<blockquote class="pull-left">
<p id="mycontainer" style="display:none;">A mathematician, scientist, and engineer are each asked: "Suppose we define a horse's tail to be a leg. How many legs does a horse have?" The mathematician answers "5"; the scientist "1"; and the engineer says "But you can't do that! </p>
<small id="author">Emmanuel Mensah </small>
</blockquote>
</body>
function myfunction() {
$("#mycontainer").show();
$("#mycontainer").typewriter();
}
相关文章:
- 如何将输入(type=text)从html表单传递到javascript函数
- window.onload没有'无法在Android WebView中工作
- 可以<脚本类型=“;text/javascript”>window.location=“/"</
- JavaScript-动态SVG-onload属性-未触发事件
- 在文本区域中使用jQuery.text()保持换行符
- 用Javascript添加带有#text的tr元素
- 当用户按下回车键时,自动在text区域/text中插入消息
- 在phonegap中为android调用onload函数的最佳方式
- 修正案'text'的元素
- 图像可以从源<img src=""/>.TEXT可以在没有javascript的情况下从外部
- image.onload事件和浏览器缓存
- 将函数从onclick修改为onload
- W3验证器->使用<脚本类型=“;text/javascript”>在html的正文中
- Combine onload, onresize and onclick
- onLoad function phonegap android
- 任何一种简单的方法都可以将带有onload的元素作为目标
- 我如何在INPUT TEXT中使用这个Javascript和jQuery
- 如果iframe在src(pdf或text)中有非html文档,则iframe中的onload不起作用
- Jquery onload/text效果后期反应
- Javascript onload回调;类型“;或“;rel”'text/plain'在脚本或链接标记上