Ajax Updates |
Change Opacity using Scriptaculous Posted: 24 Aug 2009 10:21 AM PDT Scriptaculous is a great framework to implement superb animated effects for your website. It’s simple to use and in general final result is awesome. This tutorial explains how to use Scriptaculous to implement a nice “change opacity” effect for a layer and its content. Step 1: include scriptaculous libraries Create a new page index.html and addadd a link to prototype.js and scriptaculous.js in the tag of your page:
This is an example about how to use opacity change effect. You have a container layer with ID el1, a chechkbox and some content like the following:
When you click on the checkbox, if the checkbox was "not checked" you call a function (changeOpacity()) to set the layer opacity to 30%. If the chechbox was "checked", the function set the layer opacity from 30% to 100%. You can add new similar layers using a progressive numeration for ID (el2, el3, el4...). In this case remember to change the parameter in input in changeOpacity() function for each layer (changeOpacity(2), changeOpacity(3), changeOpacity(4)...). Step 3: JavaScript function changeOpacity Now, add this simple function into the "/head" "head" tag of your page to enable change opacity effect:
Download: http://www.box.net/shared/0ep0j35c8s Source: http://woork.blogspot.com/2008/02/opacity-change-using-scriptaculous.html Related Listings:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Drag n Drop to order list Elements Posted: 24 Aug 2009 10:10 AM PDT Drag and drop feature is a popular effect in modern website interfaces and a simple way to implement it is using Scriptaculous. This tutorial explains how to use Scriptaculous to implement an HTML list with drag and drop feature to reorder list elements. Step 1: Add scriptaculous framework To enable drag and drop effect you have to download Scriptaculous framework here and add a link to prototype.js and scriptaculous.js in the “head” tag of your page:
Step 2: HTML Code Add a "ul" list with ID "myList" and some "li" elements with a progressive ID like in the following example:
Add this javascript code below the previous code:
newOrder is a string variable which returns the new order of all elements of "myList" for example: 1,2,4,3,5,6,7 ... where list element 4 has moved before list element 3. The new order is:
If you use PHP or another server side language like ASP or Coldfusion you can save the new list order assigning the value of newOrder to an hidden "input" HTML element in this way:
... and adding an hidden input field with id newOrderInput in your HTML code after
In this way every time you drag and drop a list item the value will be updated with the text string with the new order. Then you can use this string (for example "1,2,4,3,5,6,7") and PHP to save the new order into a database table. Download: http://www.box.net/shared/priaxq9s0c Source: http://woork.blogspot.com/2008/02/drag-and-drop-to-order-list-elements.html Related Listings:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posted: 24 Aug 2009 09:54 AM PDT This is the Prototype version of the extended script by Guillermo Rauch. As with the previous script, this script has been converted and operates like the original. An extended and upgraded version will be posted later on this week, if you have any comments or requests, please post them and I will try to include all the requested features in the upcoming Proto release. Here is the original post by Guillermo that describes the script: In my previous blogpost I explained how to extend TextboxList to add closing functionality via a link added to each box. But it was missing an important ingredient: autocompletion! Again, all we have to do is extend the TextboxList class, override some methods, some events, and create some new ones (all prefixed by auto) It works by caching all the results from a JSON Request and feeding them to the autocompleter object. When a item is added as a box, it' removed from the feed array, and when the box is disposed it's added back, so that it becomes available in the list when the user types. Another new feature is that you'll be able to let it add boxes from the HTML directly:
The constructor now takes new parameters to configure the autocompletion, like the minimum number of characters to trigger the dropdown, and more Demo: http://www.interiders.com/wp-content/demos/ProtoAutocompleteList/test.html Download: http://www.interiders.com/wp-content/uploads/2008/02/protoautocompletelist.rar Source: http://www.interiders.com/2008/02/11/prototextboxlist-meets-autocompletion/ Related Listings:
|
You are subscribed to email updates from Ajax Updates To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.