Skip to main content

Rút gọn phần mở rộng của Widget Archive



  Nếu bạn đang sử dụng kiểu Thứ bậc cho widget Lưu trữ Blog của bạn thì bạn sẽ thấy nó khá đồ sộ. Hôm nay, Karl sẽ giới thiệu cho các bạn cách thu gọn tự động Widget này và bạn cũng có thể mở rộng nó chỉ bằng một cú nhấp chuột.




>Demo




Lưu ý: Widget lưu trữ của bạn phải được thiết lập kiểu Thứ bậc (như trong hình) thì mới có thể thực hiện thủ thuật này.

Sau khi hoàn tất việc thiết lập cấu hình cho Lưu trữ, bạn chèn đoạn mã sau vào trước thẻ </Body>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>  
if ( $('.archivedate').hasClass('expanded') ) 
{ 
 $('.archivedate').removeClass('expanded'); 
$('.archivedate').addClass('collapsed'); 
}
</script>

Lưu Mẫu. Thế là xong!
Note:
Nếu trong Template của bạn đã có khai báo Jquery rồi thì hãy xóa dòng màu tím để tránh xung đột code.

Đoạn mã trên hoạt động như thế nào?
Trước hết chúng kiểm tra xem trong class archivedate có class nào tên là Expanded không, nếu có thì chúng sẽ thực hiện việc cắt bỏ class Expanded và thay vào đó là class collapsed.


Comments

Post a Comment

Popular posts from this blog

Leveraging the Fast TikTok API on Apify for Efficient Data Scraping

Introduction: In the world of social media data analysis, TikTok has emerged as a popular platform with a vast amount of user-generated content. To extract valuable insights from TikTok, developers and researchers often resort to web scraping. One efficient way to accomplish this task is by utilizing the Fast TikTok API on the Apify platform. In this article, we will explore the benefits and capabilities of leveraging the Fast TikTok API for data scraping on TikTok. Check the API here:  https://apify.com/novi/fast-tiktok-api

Giải trí với video hài

Hy vọng video này sẽ giúp mọi người thư giãn và xả xì trét :D

Tutorial: Scraping Data from TikTok using Fast TikTok API with Python

In this tutorial, I will guide you through the process of scraping data from TikTok using the Fast TikTok API with Python. We will be using the requests library to make HTTP requests and retrieve data from the API. Let's get started! Step 1: Obtain API Credentials Go to https://apify.com and create an account if you haven't already. Once logged in, navigate to the Fast TikTok API page ( https://apify.com/novi/fast-tiktok-api ). Follow the instructions on the page to obtain your API credentials, such as an API key or access token. Make sure to note down these credentials for future use. Step 2: Set up your Python Environment Ensure that you have Python installed on your system. You can download the latest version of Python from the official website ( https://www.python.org ). Install the requests library by running the following command in your terminal: pip install requests Step 3: Import Required Libraries Open your preferred Python IDE or text editor and create a new Python