Wordpress 3.0 jQuery - part 26

Tham khảo tài liệu 'wordpress jquery - part 26', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | AJAX with jQuery and WordPress Now as we saw in our previous examples we certainly don t want everything from the opening body tag to the closing to load in We really only want the .post div. So let s set up our .load function and narrow down what loads in as follows . jQuery content li a .click function event This keeps the href from reloading the page grab the page link var page jQuery this .attr href jQuery .displayPost use the grabbed link in the load function .load page .post .fadeOut fade out the previous content .slideDown 2000 slide in the new content Can you believe how simple that is Any link that s clicked on will fade out the content that s loaded and slide in the new content We now have a super slick effect that uses AJAX super simply on our home page. 236 Chapter 7 .getJSON The littlest birds get the most re-tweets Twitter is ridiculously popular these days as a result there are tons of great jQuery plugins for connecting to it already. My personal favorite is Damien du Toit s jQuery Plugin for Twitter http blog 2008 10 26 jquery-plugin-for-twitter. If you really want nice control over your twitter displays you can t go wrong with this plugin. However the Twitter Search and User Timeline API methods for JSON are pretty straightforward thus it makes for a great quick tutorial on how to use jQuery s .getJSON function. Plus you guessed it our hypothetical client thinks the initial home page layout might be too sparse asking if we can just add in the three latest tweets from their username. JSON and jQuery basics Before we dive into Twitter and other services let s go over the basics of JSON and how to use it with jQuery. JSON pronounced often like the name Jason is an acronym for JavaScript Object Notation. Essentially it s a simple machine-readable data-interchange format which makes constructing and working with API applications in JavaScript a snap and it can be used with other programming languages . If you re into .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.