jQuery UI 1.6 The User Interface Library for jQuery phần 7

bởi vì đề nghị này để trở vào trường văn bản thay vì của Là Tiếp liên kết, như chúng tôi dễ dàng có thể Thêm một xử lý bổ sung cho sự kiện này nhấn và di chuyển trình duyệt sang trang mới bằng tay. Hoặc, có lẽ các liên kết thể được | Chapter 8 Using draggable s methods Three methods not including the constructor are defined for draggables destroy enable disable These methods are used in the same way as the methods for the widgets that we ve already used but we ll look at a brief example for the sake of completeness. In a new page in your text editor add the following code DOCTYPE HTML PUBLIC - W3C DTD HTML EN http TR html4 html lang en head link rel stylesheet type text css href styles meta http-equiv Content-Type content text html charset utf-8 title jQuery UI Draggable Example 13 title head body button id disable Disable button button id enable Enable button button id destroy Destroy button div id drag div script type text javascript src script script type text javascript src ui script script type text javascript src ui script script type text javascript function to execute when doc ready function make the specified element draggable drag .draggable define function to toggle draggability function toggle action action destroy drag .draggable action .removeClass drag drag .draggable action 243 Drag and Drop define click handler for buttons button .click function toggle this .attr id script body html Save this as . The page contains three buttons in addition to the draggable which will be used to drive the method functionality in this example. The script is also very straightforward. Whenever a button is clicked we simply get the id of the button and call the toggle function passing in the id we just obtained from the button as an argument. The toggle function then calls the method specifying the string it received as an argument. This way it doesn t matter which button gets clicked the appropriate method will be called. There is also an additional layer of checking that is done with the JavaScript ternary. Unfortunately the functionality of the destroy

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
2    156    1    07-05-2024
Đã 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.