PHP and script.aculo.us Web 2.0 Application Interfaces- P6
Số trang: 30
Loại file: pdf
Dung lượng: 1.16 MB
Lượt xem: 10
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
PHP and script.aculo.us Web 2.0 Application Interfaces- P6: script.aculo.us là một thư viện JavaScript cung cấp các hiệu ứng thị giác năng động, điều khiển giao diện người dùng, và các tính năng mạnh mẽ AJAX. Đó là những gì phụ-client PHP là phía máy chủ - mạnh mẽ, đơn giản, vui vẻ hoàn tất, và trên tất cả, PHẢI một! Theo các nhà phát triển, chúng tôi tất cả ước mơ xây dựng các ứng dụng mà người sử dụng ngay lập tức có thể rơi vào tình yêu với và nhận được hiệu quả. Đơn giản và các...
Nội dung trích xuất từ tài liệu:
PHP and script.aculo.us Web 2.0 Application Interfaces- P6 Chapter 8Horizontal sliderWhen the axis orientation of a slider is defined as horizontal, the slider becomes andacts as a horizontal slider.So lets get our hands dirty with code and start defining the constructors forhorizontal and vertical slider with options. Trust me this will be fun.Code usage for the sliderAs a developer, I am sure you must have got a little bored reading only explanation.But hey hang on, we are getting into code!Lets start with our HTML code and then the basic constructor definition ofthe slider.The HTML code snippet is shown as follows: div>Here, we have defined our track and handle as elements.The handle element should be placed inside the track element. eGood. So lets define the constructor for the slider here: new Control.Slider(handle1, track1);Thats it! No, wait. We are missing something. Although the code is perfect, when wefire it up in the browser we cant see anything. Thats because we need to style it.The complete code with CSS is shown as follows: window.onload = function() { new Control.Slider(handle1, track1 ); } h4{ font: 13px verdana } #track1 { background-color:#BCE6D6; height: 1em; width: 150px; } [ 139 ]Slider for Dynamic Applications using script.aculo.us #handle1 { background-color:#30679B; height: 1em; width: 6px; } Basic Slider Example And the resulting output is shown in the following screenshot:Thats the most basic slider we created. And I am sure you are not content with that.We need to explore more.Code usage for the vertical sliderMoving on, we will now create a vertical slider and add some options to enhance ourslider feature.Most of the code remains from the above example. We will focus on the requiredchanges to be made in the above code.As mentioned in the explanation above, we need to define the axis orientation asvertical in our options to make a slider vertical. axis: vertical [ 140 ] Chapter 8So, the new constructor looks like the snippet shown as follows: window.onload = function() { new Control.Slider(handle1, track1, { axis:vertical } ); }And yes, since we are trying to make our slider vertical we need to change the CSSproperties of height. The new CSS code will look like the following snippet: #track1 { background-color:#BCE6D6; height: 10em; width: 15px; } #handle1 { background-color:#30679B; height: 1em; width: 15px; }So, the final script for the vertical slider is shown as follows: window.onload = function() { new Control.Slider(handle1, track1, { axis:vertical } ); } h4{ font: 13px verdana } #track1 { background-color:#BCE6D6; height: 10em; width: 15px; } #handle1 { [ 141 ]Slider for Dynamic Applications using script.aculo.us background-color:#30679B; height: 1em; width: 15px; } Basic Vertical Slider Example And, the beautiful vertical slider is here! Check out the following screenshot:Code usage for the horizontal sliderWe have seen how to create a vertical slider. We want you to have a wild guess ofhow to make a horizontal slider. Let me give you two hints: • We dont have to struggle to make a slider horizontal. Its the default axis option. • We can make a horizontal slider by passing the horizontal option to axis. [ 142 ] Chapter 8Which one would you prefer?I am not going to give you code for this one though. But yes, I will guide you fordoing the same. The code will be given in the next chapter.We have already created one horizontal slider in the Code usage for the horizontal slidersection. That was one approach. Now try changing the axis option to horizontal inthe above code for the vertical slider.You may also need to change some CSS properties for height and width, and I amsure you would love doing them. Its so much fun! After you make changes to theheight and width parameters of the CSS properties, the screenshot of slider shouldlook like the following:Code usage for sliders with optionsWe are now done with t ...
Nội dung trích xuất từ tài liệu:
PHP and script.aculo.us Web 2.0 Application Interfaces- P6 Chapter 8Horizontal sliderWhen the axis orientation of a slider is defined as horizontal, the slider becomes andacts as a horizontal slider.So lets get our hands dirty with code and start defining the constructors forhorizontal and vertical slider with options. Trust me this will be fun.Code usage for the sliderAs a developer, I am sure you must have got a little bored reading only explanation.But hey hang on, we are getting into code!Lets start with our HTML code and then the basic constructor definition ofthe slider.The HTML code snippet is shown as follows: div>Here, we have defined our track and handle as elements.The handle element should be placed inside the track element. eGood. So lets define the constructor for the slider here: new Control.Slider(handle1, track1);Thats it! No, wait. We are missing something. Although the code is perfect, when wefire it up in the browser we cant see anything. Thats because we need to style it.The complete code with CSS is shown as follows: window.onload = function() { new Control.Slider(handle1, track1 ); } h4{ font: 13px verdana } #track1 { background-color:#BCE6D6; height: 1em; width: 150px; } [ 139 ]Slider for Dynamic Applications using script.aculo.us #handle1 { background-color:#30679B; height: 1em; width: 6px; } Basic Slider Example And the resulting output is shown in the following screenshot:Thats the most basic slider we created. And I am sure you are not content with that.We need to explore more.Code usage for the vertical sliderMoving on, we will now create a vertical slider and add some options to enhance ourslider feature.Most of the code remains from the above example. We will focus on the requiredchanges to be made in the above code.As mentioned in the explanation above, we need to define the axis orientation asvertical in our options to make a slider vertical. axis: vertical [ 140 ] Chapter 8So, the new constructor looks like the snippet shown as follows: window.onload = function() { new Control.Slider(handle1, track1, { axis:vertical } ); }And yes, since we are trying to make our slider vertical we need to change the CSSproperties of height. The new CSS code will look like the following snippet: #track1 { background-color:#BCE6D6; height: 10em; width: 15px; } #handle1 { background-color:#30679B; height: 1em; width: 15px; }So, the final script for the vertical slider is shown as follows: window.onload = function() { new Control.Slider(handle1, track1, { axis:vertical } ); } h4{ font: 13px verdana } #track1 { background-color:#BCE6D6; height: 10em; width: 15px; } #handle1 { [ 141 ]Slider for Dynamic Applications using script.aculo.us background-color:#30679B; height: 1em; width: 15px; } Basic Vertical Slider Example And, the beautiful vertical slider is here! Check out the following screenshot:Code usage for the horizontal sliderWe have seen how to create a vertical slider. We want you to have a wild guess ofhow to make a horizontal slider. Let me give you two hints: • We dont have to struggle to make a slider horizontal. Its the default axis option. • We can make a horizontal slider by passing the horizontal option to axis. [ 142 ] Chapter 8Which one would you prefer?I am not going to give you code for this one though. But yes, I will guide you fordoing the same. The code will be given in the next chapter.We have already created one horizontal slider in the Code usage for the horizontal slidersection. That was one approach. Now try changing the axis option to horizontal inthe above code for the vertical slider.You may also need to change some CSS properties for height and width, and I amsure you would love doing them. Its so much fun! After you make changes to theheight and width parameters of the CSS properties, the screenshot of slider shouldlook like the following:Code usage for sliders with optionsWe are now done with t ...
Tìm kiếm theo từ khóa liên quan:
phương pháp lập trình lập trình web với php ngôn ngữ lập trình php lập trình javascriptGợi ý tài liệu liên quan:
-
Giáo trình Lập trình logic trong prolog: Phần 1
114 trang 192 0 0 -
Giáo trình Lập trình C căn bản: Phần 1
64 trang 170 0 0 -
Giáo trình Lập trình C căn bản
135 trang 168 0 0 -
66 trang 154 0 0
-
14 trang 134 0 0
-
Bài giảng Phương pháp lập trình: Chương 9 - GV. Từ Thị Xuân Hiền
36 trang 112 0 0 -
Giáo trình lập trình hướng đối tượng - Lê Thị Mỹ Hạnh ĐH Đà Nẵng
165 trang 112 0 0 -
47 trang 111 2 0
-
78 trang 102 0 0
-
Giáo trình về môn Lập trình C căn bản
131 trang 50 0 0