<script>
$(document).ready(function(){
});css
首先,在页面顶部添加一行script
元素,而后在下一行写上结束符。html
浏览器会运行script
里全部的Javascript,包括jQuery。浏览器
在你的script
元素里,添加这段代码:$(document).ready(function() {
到你的script
中,而后在下一行用});
结束它。app
<script>
$(document).ready(function() {
$("button").addClass("animated");
$(".btn").addClass("shake");
$("#target1").addClass("btn-primary");//首选项
});
</script>spa
$("#target1").css("color", "blue");code
$("button").prop("disabled", true);htm
$("h3").html("<em>jQuery Playground</em>");索引
$("#target4").remove();ip
$("#target4").appendTo("#left-well");rem
$("#target2").clone().appendTo("#right-well");//两个jQuery方法合在一块儿使用了?这种叫方法链function chaining
把target2
从left-well
复制到right-well
,
$("#left-well").parent().css("background-color", "blue")
$("#left-well").children().css("color", "blue")
$(".target:nth-child(3)").addClass("animated bounce");
//如下代码显示如何给jQuery Playground中的每一个井中(left well和right well)的第三个子元素添加bounce类:
$(".target:even").addClass("animated shake"); //偶数
$(".target:odd").addClass("animated shake");//奇数
$("body").addClass("animated fadeOut");//整个body有淡出效果
$("body").addClass("animated hinge");//一左上角为圆心 顺时针晃动 下坠淡出