gpt4 book ai didi

javascript - 飞入的页面元素

转载 作者:行者123 更新时间:2023-11-29 18:13:53 26 4
gpt4 key购买 nike

我的目的是修改我的页面以通过“飞入”加载元素。我找到了 this JSFiddle example ,我现在应该让它在页面加载时发生,而无需单击任何内容。所以它在页面加载时触发。

$(function() {
$("#add-sidebar-module").on("click", function() {
$("<div />", {
'class': "module",
text: "I'm new here."
}).prependTo("#sidebar");
});

$("#add-article").on("click", function() {
$("<div />", {
'class': "module",
html: "<h1>Title</h1><p>text text text.</p>"
}).prependTo("#main");
});
});

我还担心页面加载和动画方面存在某种问题。欢迎提供确保尽可能顺利的提示和技巧!

最佳答案

http://jsfiddle.net/PJN6r/

<div class="animate-on-load">
This is animated
</div>


$('.animate-on-load').addClass('module');

根据您的要求。

我不建议触发页面加载点击。只需在加载时添加类。

关于javascript - 飞入的页面元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24991108/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com