Введение в jquery. Часть 2
На прошлом уроке мы познакомились с библиотекой jquery. В этом уроке мы рассмотрим другие полезные функции данной библиотеки.
Код урока
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<button>Click</button>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam quos minima dolor delectus culpa, est error voluptatum iste autem. Corporis doloremque, repellendus, libero veniam quisquam voluptatibus eum vel asperiores praesentium.
<img src="https://placekitten.com/g/150/150" alt="">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
/*$("button").click(function(){
$(".text").fadeToggle();
})*/
if($("p").hasClass("text")) {
$(".text").addClass("superClass");
}
console.log($(".text").height());
/*$("button").click(function(){
$(".text").toggle();
})*/
/*$(".text").hover(function(){
alert("На меня навели");
});*/
var txt = $(".text").html();
console.log(txt);
var parent = $(".text").parent();
console.log(parent);
$(".text").prepend("
<h1>Hello world</h1>
");
$(document).ready(function(){
});
$(window).scroll(function(){
$("body").css("background-color", "green");
});
$("img").click(function(){
$("img").slideUp();
});
$(".text").text("jquery rules");
console.log($(window).width());
</script>
</body>
</html>
0 Комментариев