This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery là một thư viện javascript rất phổ biến, nó phổ biến đến mức một số bạn bè mình quen viết jQuery mà không biết gì về javascript. | |
Có thể nói jQuery giống như một cô nàng hiểu tâm lý và rất biết chiều chuộng khách, khách cần gì là có đó ngay, đi từ A tới Z luôn. | |
Tuy nhiên cái gì cũng có hai mặt của nó, những mặt chưa được mình sẽ nói ở cuối bài. Bài viết này cũng không nhằm mục đích khuyên các bạn chia tay với cô nàng jQuery, nhưng hãy thử một ngày xa nàng xem sao, biết đâu bạn nhận ra rằng cuộc sống độc thân tuyệt vời biết bao. | |
Một số ví dụ no-jQuery | |
1. Lắng nghe sự kiện | |
Nhiều developer có thói quen bao toàn bộ code js bởi $(document).ready(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://gist.github.com/luetkemj/2023628 | |
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz | |
<?php | |
$args = array( | |
//////Author Parameters - Tham số lấy bài viết theo tác giả | |
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters | |
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20) | |
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả | |
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function objectifyForm(formArray) { //serializeArray data function | |
var returnArray = {}; | |
for (var i = 0; i < formArray.length; i++){ | |
returnArray[formArray[i]['name']] = formArray[i]['value']; | |
} | |
return returnArray; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.getScript("http://localhost/sparkleHover.js", function() { | |
console.log("Script loaded but not necessarily executed."); | |
$(".team-wrap").sparkleHover({ | |
lifespan: 1000, | |
}); | |
$(".team-wrap ul").sparkleHover({ | |
colors : ['purple', 'pink', 'red'], | |
num_sprites: 24, | |
lifespan: 1000, | |
radius: 800, |