Trong bài này chúng ta sẽ tìm hiểu thuộc tính data-position-to trong jQuery Mobile, đây là một thuộc tính giúp xác định nơi hiển thị của Popup hoặc dialog.
1. Data-position-to trong jQuery Mobile
Thuộc tính data-position-to giúp xac popup sẽ hiển thị tại vị trí nào. Nó có ba giá trị như sau:
- window: hiển thị ngay giữa màn hình
- origin: hiển thị ngay tại button mà ta click
- #selector: ID của thẻ HTML nào đó
Ví dụ: XEM DEMO
<div data-role="page"> <div data-role="header" id="position-header"> <h2>Position To</h2> </div> <div role="main" class="ui-content"> <a href="#positionWindow" class="ui-btn ui-btn-inline" data-rel="popup" data-position-to="window">Position to window</a> <br/> <a href="#positionOrigin" class="ui-btn ui-btn-inline" data-rel="popup" data-position-to="origin">Position to origin</a> <br/> <a href="#positionSelector" class="ui-btn ui-btn-inline" data-rel="popup" data-position-to="#position-header">Position to #position-header</a> <div data-role="popup" id="positionWindow" class="ui-content" data-theme="a"> <p>I am positioned to the window.</p> </div> <div data-role="popup" id="positionOrigin" class="ui-content" data-theme="a"> <p>I am positioned over the origin.</p> </div> <div data-role="popup" id="positionSelector" class="ui-content" data-theme="a"> <p>I am positioned over the header for this section via a selector. If the header isn't scrolled into view, collision detection will place the popup so it's in view.</p> </div> </div> </div>
2. Lời kết
Đáng lẽ trong bài tìm hiểu Popup mình giới thiệu luôn nhưng vì bài đó dài rồi nên mình tách ra, một phần giúp bạn dễ tìm kiếm và một phần giảm thời lượng học của bài đó.
Bài viết này được đăng tại [kiso.vn]
Bài tiếp theo chúng ta sẽ tìm hiểu về Toolbar.
Bài viết liên quan
[CSF-2] Một số thiết lập CSF, LFD
Hôm nay mình sẽ thực hiện một số thiết lập trên CSF Mở file config để sửa đổi một số tính năng dưới /etc/csf/csf.conf Nội dung chính1. Data-position-to trong jQuery Mobile2. Lời kết1. Bảo vệ...
[CSF-1] Tăng bảo mật Server với ConfigServer Firewall (CSF)
Nội dung chính1. Data-position-to trong jQuery Mobile2. Lời kết1. Khái niệm CSF: CSF (ConfigServer & Firewall) là một bộ ứng dụng hoạt động trên Linux như một firewall được phát hành miễn phí để tăng...
Sử dụng SSH Key với Gitlab và Github
Bài viết này mình sẽ hướng dẫn các bạn tạo ssh key cho Gitlab và Github SSH là gì? Secure Socket Shell là một giao thức mạng dùng để thiết lập kết nối mạng một...
Directory traversal vulnerabilities (phần 4)
Nội dung chính1. Data-position-to trong jQuery Mobile2. Lời kếtV. Phân tích và khai thác các lỗ hổng Directory traversal (tiếp) 5. Bypass lỗ hổng khi trang web sử dụng đường dẫn đầy đủ Xét đoạn...
Directory traversal vulnerabilities (phần 3)
Nội dung chính1. Data-position-to trong jQuery Mobile2. Lời kếtV. Phân tích và khai thác các lỗ hổng Directory traversal 1. Lỗ hổng xảy ra khi sử dụng các hàm đọc file và tin tưởng đầu...
Directory traversal vulnerabilities (phần 2)
Nội dung chính1. Data-position-to trong jQuery Mobile2. Lời kếtIII. Vì sao lỗ hổng Directory traversal xuất hiện? Với mỗi ngôn ngữ lập trình khác nhau, điểm xuất hiện các lỗ hổng Directory traversal cũng khác...