Các Hiệu ứng Slide Trong JQuery. - Viquynhh
Có thể bạn quan tâm
Chào các bạn, blog hôm nay mình sẽ giới thiệu cho các bạn một số hiệu ứng slide trong jQuery và hướng dẫn tạo 1 slide đơn giản. Mong rằng blog của mình sẽ hữu ích với các bạn ! Trước tiên bạn chèn jQuery vào tài liệu html của mình Giới thiệu về jQuery. Chú ý là phải đặt như sau:
http://js/jquery-3.1.1.min.js http://js/main.jsI. Giới thiệu một số hiệu ứng slide trong jQuery.
1. slideDown();
Cú pháp :
$(selector).slideDown(speed,callback);Vd:
$("flip").click(function(){ $("#panel").slideDown(); });Vd 2:
HTML :

CSS:
#panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; } #panel { padding: 50px; display: none; }jQuery:
$(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideDown("slow"); }); });
2.slideUp();
Cú pháp :
$(selector).slideUp(speed,callback);Vd:
$("#flip").click(function(){ $("#panel").slideUp(); });Vd2:
HTML :

CSS :
#panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; } #panel { padding: 50px; }jQuery:
$(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideUp("slow"); }); });
3.slideToggle() ;
Cú pháp :
$(selector).slideToggle(speed,callback);Vd:
$("#flip").click(function(){ $("#panel").slideToggle(); });Vd2:
HTML :

CSS:
#panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; } #panel { padding: 50px; display: none; }jQuery:
$(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideToggle("slow"); }); });
4. Một sốjQuery Effects .
-
jQuery animate() Method
-
jQuery clearQueue() Method
$("button").click(function(){ $("div").clearQueue(); }); -
jQuery dequeue() Method
-
jQuery fadeToggle() Method
-
jQuery finish() Method
-
jQuery hide() Method
-
jQuery queue() Method
-
jQuery Effect show() Method
-
jQuery stop() Method
-
jQuery toggle() Method
II. HƯớng dẫn tạo một slide đơn giản bằng jQuery.
1. Slide đơn giản .
file js :
file ảnh :
HTML:
CSS :
#fpt-slider{ margin-right: auto; margin-left: 500px; width: 720px; } #fpt-slider img{ -webkit-box-shadow: 9px 5px 28px 10px rgba(0,0,0,0.75); -moz-box-shadow: 9px 5px 28px 10px rgba(0,0,0,0.75); box-shadow: 9px 5px 28px 10px rgba(0,0,0,0.75); -webkit-transition: 1s; transition: 1s; top: 100px; } #fpt-slider>a.left{ position: absolute; top:260px; left: 475px; color: #000; text-decoration: none; font-size: 20px; font-weight: bold; } #fpt-slider>a.right{ position: absolute; top:260px; right: 420px; color: #000; text-decoration: none; font-size: 20px; font-weight: bold; } #fpt-slider>h2{ color: black; position: absolute; top:470px; left: 610px; width: 700px; text-shadow: 6px 6px 6px rgba(150, 150, 150, 0.8); font-size: 30px; font-family: 'Pacifico', cursive; opacity: 0.9; } #fpt-slider ul{ display: none; }jQuery :
$(document).ready(function(){ var current=0; var max=$('li.item').length-1; //console.log(max); function display(){ var currentItem=$('.item')[current]; var html=$(currentItem).html(); var img=$(currentItem).attr('data-img'); $('#fpt-slider>h2').html(html); $('#fpt-slider>img').attr('src',img); } $('a.left').click(function(event){ if(current===0){ current=max; }else{ current--; } display(); //console.log("noi dung" +html); //console.log("img: "+img); event.preventDefault(); /* Tắt chuyển # */ }); $('a.right').click(function(event){ if(current===max){ current=0; }else{ current++; } display(); event.preventDefault(); }); //setInterval(function(){ // $('a.right').click(); //})1000s; });2. slide đẹp.

File : /html/css/jQuery
Share this:
- X
Related
Từ khóa » Các Hiệu ứng Jquery
-
Hiệu ứng Trong JQuery - Trần Ngọc Minh Notes
-
Hiệu ứng Trong Jquery - Thầy Long Web
-
Hiệu ứng Trong JQuery - Hoclaptrinh
-
Hiệu ứng động Với Animate() Trong JQuery
-
Tất Cả Hiệu ứng Trong JQuery - Web Cơ Bản
-
Hiệu ứng động (Animation) Trong JQuery - Web Cơ Bản
-
Hiệu Ứng Trong JQuery - CodeHub
-
Hiệu ứng động Trong JQuery - Thủ Thuật
-
[jQuery] Bài 3 - Tạo Hiệu Ứng Chuyển Tiếp & Gửi Yêu Cầu Tới Máy ...
-
[Bài 4] Hiệu ứng Trong Jquery
-
JQuery: Hiệu ứng Animate | V1Study
-
JQuery Effects - Hiệu ứng Trong JQuery - Quách Quỳnh
-
JQuery Là Gì? Ứng Dụng JQuery Và ưu điểm Nổi Bật | TopDev
-
Tạo Hiệu ứng Chữ, Hình ảnh Di Chuyển Với Marquee JQuery Plugin ...