Wordpress 3.0 jQuery phần 4

Đó là nó! Đầu tiên của bạn, tăng cường jQuery hữu ích cho WordPress. Dưới đây là một ảnh chụp màn hình của những gì nó trông giống như:Ngoài ra, tôi đánh giá cao đề nghị bằng văn bản riêng biệt, chức năng được đặt tên. Ví dụ, nó dễ dàng hơn nhiều để đọc: | Simpo PDF Merge and Split Unregistered Version - http Working with jQuery in WordPress Last let s make sure the instructions in the .openlt div update jQuery .openIt .toggle function jQuery this .html Close function jQuery this .html Expand That s it Your very first useful jQuery enhancement for WordPress. Here s a screenshot of what it looks like 82 Simpo PDF Merge and Split Unregistered Version - http Chapter 2 Keeping jQuery readable In the real world this enhancement could be cleaned up and refined quite a bit. For example it would be better to have an existing CSS style for .openlt instead of applying styles to the div. Also I highly recommend writing separate named functions. For example it s much easier to read . jQuery .openIt .toggle closePost expandPost And then below that see function expandPost evt jQuery . function closePost evt jQuery . . If you find yourself working on a project with other developers consider breaking your functions down like this rather than packing them directly into jQuery functions as my first example did. It makes for more maintainable code and you can reuse your functions with other jQuery functions and scripts. Summary To recap we took a look at getting jQuery included into WordPress by registering WordPress bundled version and by using Google s CDN. We also took a look at jQuery s top three secret weapons Selectors and filters Manipulating and changing content Events and effects After exploring the basics of jQuery within WordPress and getting a feel for how they work you may feel like you re good to go In many ways you are but we re going to continue exploring WordPress and jQuery in more detail about the parts of WordPress that generate content we can enhance with jQuery We ll look deeper into WordPress themes and plugins as well as take a look at another type of plugin the jQuery plugin. Themes and plugins can make our WordPress development work very powerfully and .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
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.