Ajax Updates

Ajax Updates


jQuery ImageSwitch

Posted: 25 Sep 2009 12:09 PM PDT

The main point of this plug-in is to make an easy-to-use, simple and fast plug-in to create effect when you switch between images. Minimize the arguments you need to input and still give some decent effects.

Why using this

With jQuery, it's so easy to create simple effect such as fade in, move object around… unfortunately when you need to create an effect for image switching, it will require a bit more to create an attractive effect. That isn't difficult but it isn't simple and sometimes it's kind of mess your code up as you need to manage more codes.

Developer friendly

All the code is commented to explain itself. The reason is so everyone could read and understand the code edit it to suitable with the situation you want. Sometime you only need just 1 single effect not the whole plug-ins so you could change it to optimize for you situation.

Usage Full syntax:

Bellow is the full syntax of ImageSwitch with its default value:

 $.ImageSwitch({ 	Type: "FadeIn", // Type of effect to run the function 	NewImage: "", //The new image will be loaded in 	EffectOriginal: true, 	Speed: 1000, //Speed of the effect 	StartLeft: 50, //The position the effect start compare to original position could be (-) 	StartTop: 0, 	StartOpacity: 0, //Which start opacity it would be 	EndLeft: -50, //The position the effect end compare to the original position could be (-) 	EndTop: 0, 	EndOpacity: 0, //Which start opacity it would be 	Direction: "RightLeft", //Which Way the image will be sroll 	Door1: "", //The image for the door 1 	Door2: "" //The image for the door 2 }, function); 

Although it's quite long, all the effect could work with only 2 settings: "Type" and "NewImage".
You could still use it with only "NewImage" setting as ImageSwitch it will run "FadeIn" as default.



Demo: http://www.hieu.co.uk/blog/index.php/imageswitch/imageswitch-example/
Download: http://www.hieu.co.uk/blog/wp-content/plugins/download-monitor/download.php?id=Groject.ImageSwitch.yui.js
Source: http://www.hieu.co.uk/blog/index.php/imageswitch/

Related Listings:

  1. 10 incredible JQuery navigation menus JQuery is a lightweight, cross-browser compliant, and extremely powerful Javascript...
  2. jQuery Image Stip Working for Obu Web i've found myself spending less time...
  3. jQuery Calculate Plugin The Calculation plug-in is designed to give easy-to-use jQuery...

jQTouch Cell Phones Animation using Jquery

Posted: 25 Sep 2009 11:25 AM PDT

A jQuery plugin for mobile web development on the iPhone,
Android, Palm Pre, and other forward-thinking devices.

GettingStarted
Installing and initializing jQTouch

1. Add Scripts

jQTouch currently uses jQuery 1.3.2, which can be loaded dynamically from Google Code. In the of your document, insert the following:



2. Initialize

Initialize the function before the page onload event. To turn off a feature, simply pass a false to the corresponding option in the initialization options.

   $.jQTouch({         icon: 'jqtouch.png',         statusBar: 'black-translucent',         preloadImages: [             'themes/jqt/img/chevron_white.png',             'themes/jqt/img/bg_row_select.gif',             'themes/jqt/img/back_button_clicked.png',             'themes/jqt/img/button_clicked.png'             ]     });

3. Extend
* Initialization Options – Overview of all basic capabilities, including navigation, viewport control, and image preloading.
* Callback Events – How to receive notifications from jQTouch.
* Building Fullscreen Applications – Extended details about creating full-screen iPhone web apps.
* Using Ajax – A wide array of methods to load dynamic data and render on the fly.



Demo: http://www.jqtouch.com/preview/demos/main/
Download: http://jqtouch.googlecode.com/files/jqtouch-1.0-beta.zip
Source: http://www.jqtouch.com/

Related Listings:

  1. Jquery Button Animation A jQuery plug-in that does a PNG animation on hover...
  2. jQuery Flick This plugin adds Apple iPod/iPhone (firmware 2.0+) flick/scroll functionality to...
  3. iPhone Interface in Javascript This script can generate and embed Iphone like interface on...

Javascript Calendar Using MooTools

Posted: 25 Sep 2009 10:51 AM PDT

The idea is to use MooGenda to quickly expose your events from a json request. You can customize your event in week view and in day view.

Features:
* A javascript calendar based on MooTools.
* Read events from a JSON (like this)
* Double click on event to see the deafult event view.
* Double click on month’s day to see the default event to add memo to calendar.
* Drag and drop event in month view.
* Drag and drop and resize event in diary view.
* Every change send a request to back end, to store when and what changed in the event

On startup code reads a json like this (IMPORTANT: read the meaning of each variable to customize your MooGenda):

 {    "events": [         { //day number             "day": 1, //an id             "elNum": 1, //a title for the event             "title": "Lesson about Mootools", //a complete description, it can have also html content             "desc": "In Altedo, at <a href=\"http://www.iprov.com\">IPROV</a>, we have our course. " //when the event starts         	,"timeStart":"8.5", //how long is the event 			"timeLong":"3" 		}, .... 		   ] }

A complete JSON is at the demo url: CALENDAR EVENTS’ JSON

The request has these POST parameters (for your customization):

1. month : a number (1,..12) for the month we want to retrieve events’
2. requestType :getEventDate (for clean coding purpose)

When an event is moved, resized or dragged MooGenda launch a request to an url to store the new home’s configuration choiced from the user. This service gives a JSON response like that:

 { "result":"ok" }

or like that:

 { "result":"ko" }

This is a response caused by these parameters:

1. day : the day number that contain our event
2. el: idCont (i.e 4Cont if id is 4) . The id of element that contain our event in diary view (week or day)
3. id: a unique number for every event
4. month: the month number that contain the day for our event (1,..,12)
5. requestType:storeEventDay (for clean coding purpose)
6. timeLong: a number that represent how long is now our event (in hours)
7. timeStart: a number that rapresent when our event starts.
CREATE A MOOGENDA INSTANCE
To create a MooGenda instance use a minimal code like that:

 <div id="moogenda"></div>  			<script>  			window.addEvent('domready',function(){ 	var mooGenda = new MooGenda({ 							id:'thisMonth', 							dateObject:new Date(), 							where:'moogenda', 							header:'MooGenda: my MooTools based Agenda'}); 	mooGenda.write(); });  			</script> 

A complete option’s list:

1. id: An id for the MooGenda object,
2. dateObject: date when we want moogenda starts (default is the current day),
3. where: the id or div container for moogenda,
4. getEventUrl: an url to get events’ json: default, ‘data/getEvent.json’
5. storeEventUrl: an url to store events’ json: default, ‘data/storeEvent.json’
6. state: the view we want moogenda starts with, default is month (admitted value are key.WEEK,key.MONTH,key.DAY)
7. h_start: the starting time for agenda/diary view (default 0)
8. h_stop: the ending time for agenda/diary view (default 24)




Demo: http://www.moonkiki.com/moogenda/moogenda.html
Download: http://s5.histats.com/stats/r.php?475276&100&2&urlr=&www.moonkiki.com/moogenda/moogenda.zip
Source: http://www.moonkiki.com/moonkiki/moogenda/

Related Listings:

  1. MooTools Events Calendar # calContainer – (string:defaults to null) the id of the...
  2. Selecting Dates in Calendar Script A function that will select all dates in the currently...
  3. FullCalendar – Full-sized Calendar jQuery Plugin FullCalendar is a jQuery plugin that provides a full-sized, drag...

Custom HTML Buttons and Form Elements

Posted: 25 Sep 2009 10:19 AM PDT

Have you ever wanted to use your own images for checkboxes, radio buttons or select lists? This script will let you do that. Easily. The unobtrusive script gracefully degrades, so if JavaScript is disabled, normal form input objects appear instead of your customized elements. This works flawlessly in Firefox, Safari, Internet Explorer 7, Opera and others. In Internet Explorer, the select lists are unstyled, but the checkboxes and radio buttons still look and function beautifully. It’s this easy:

<input type="checkbox" class="styled" /> 

Usage

You are free to share, alter and use this script commercially. Just leave the title, my name and website in tact in the JavaScript script. This script is licensed under a Creative Commons license.

How does it work?

In a nutshell, the JavaScript looks for any form element with class=”styled” declared; hides the real element; sticks a span tag with a CSS class on it next to the element; and, finally, mouse events are added to the span that handles the stages when it is clicked.

To get the checkboxes, radio buttons and select boxes to work properly, you’ll need to change three variables in the script: checkboxHeight, radioHeight and selectWidth on lines 21-23. If you use the images I created, you won’t have to change the variables, but if you make your own, chances are you’ll have to. The checkboxes and radio buttons to the right are linked to transparent PNG images for you to use freely if you’d like. The frist two variables are the height of a single stage of the checkbox and radio button, and the third is the width of the select box. You may need to spend a little time tinkering with the checkbox and radio button images so they don’t twitch during different stages.

  var checkboxHeight = "25";  var radioHeight = "25";  var selectWidth = "190";  

The CSS

If you make your own images, you may need to change a few things in the cascading style sheet. In span.checkbox and span.radio, the height property should be one fourth of the height of the full size images. You also might have to change the width property in span.select selector. You probably won’t have to edit any other portions of the CSS, but regardless, this part is still straight forward.

     span.checkbox {      width: 19px;      height: 25px;      padding: 0 5px 0 0;      background: url(checkbox.gif) no-repeat;      display: block;      clear: left;      float: left;    }    span.radio {      width: 19px;      height: 25px;      padding: 0 5px 0 0;      background: url(radio.gif) no-repeat;      display: block;      clear: left;      float: left;    }    span.select {      position: absolute;      width: 158px; /* With the padding included, the width is 190 pixels: the actual width of the image. */      height: 21px;      padding: 0 24px 0 8px;      color: #fff;      font: 12px/21px arial,sans-serif;      background: url(select.gif) no-repeat;      overflow: hidden;  }

The XHTML

The script won’t customize checkboxes, radio buttons or select lists unless you declare the styled class. Simply add class=”styled” to any checkbox, radio button or option list and the JavaScript and CSS will take over from there.

   <input type="checkbox" name="a" checked="checked" class="styled" /> Sexy     <input type="checkbox" name="b" class="styled" /> Boring     <input type="radio" name="c" checked="checked" class="styled" /> Radical     <input type="radio" name="c" class="styled" /> Poor     <select name="d" class="styled">       <option value="1">Option 1</option>       <option value="2">Option 2</option>       <option value="3">Option 3</option>       <option value="4">Option 4</option>    </select>




Demo: http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/
Download: http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/custom-form-elements.js
Source: http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

Related Listings:

  1. Custom HTML Form Elements Have you ever wanted to use your own images for...
  2. Custom form elements This JavaScript and CSS will allow you to use custom...
  3. Form Field Hints with CSS and Html It’s a basic example of how helpful a little...

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.