• Skip to main content
  • Bỏ qua primary sidebar
  • Trang chủ
  • Tút
    • Directadmin
    • WordPress
  • Code
    • Account
    • License
  • Service
  • Template
    • Open Cart
    • WordPress
      • Website doanh nghiệp
      • Website bán mỹ phẩm
      • Website bất động sản
    • Miễn phí
  • VPS
  • Check IP Location

Việt Beginner

Chia sẻ cho những ai cần đọc

Bạn đang ở:Trang chủ / Tút / Wordpress / Code js xử lý table trên mobile

Code js xử lý table trên mobile

02/01/2020 by Mcode Để lại bình luận

Thông thường table nó không hiển thị tốt trên mobile đối với các web chạy giao diện resposive.

Hôm nay mình chia sẻ đoạn code js ngắn để chống lại việc nó tràn viền trên mobile. Thay vào đó nó sẽ trược ngang trên màn hình mobile

Cách làm: thêm code js vào footer của theme, thêm trực tiếp vào theme hoặc dùng plugin Insert header and footer hoặc các theme có hỗ trợ tính năng chèn code js vào footer.

Code:

<script>
jQuery(document).ready(function($) {
    $("table").not(".variations").wrap('<div class="mhs-table"></div>');
    $(".mhs-table").css("overflow-x","auto");
})
</script>

Nếu hệ thống báo lỗi không nhận được biến jQuery, các bạn hãy thêm thư viện này vào footer, ngay dưới đoạn script trên

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

Tham khảo thêm các phiên bản (có thể có bản mới hơn) tại: https://developers.google.com/speed/libraries/

Chúc các bạn thành công!

Thuộc chủ đề:Wordpress

Reader Interactions

Trả lời Hủy

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Sidebar chính

THIẾT KẾ WEBSITE UY TÍN

Thẻ

bài viết liên quan cloudlinux cloud storage cpanel csf firewall cài đặt cloudlinux cài đặt directadmin directadmin directadmin crack directadmin openlitespeed diệt malware diệt virus DKIM google clou google cloud google drive unlimited imunify imunify 360 LEMP let's encrypt lưu trữ hình ảnh ngoài hosting mariadb myportal nginx nâng cấp mariadb office 365 openlitespeed popup flatsome port login sale badge service is currently down ssl ssl giá rẻ swap system load Theme blog theme miễn phí theme tin tức theme tạp chí tường lửa warning wildcard ssl woocommerce wpml xử lý mã độc

Copyright © 2021 · MH Solutions · Đăng nhập