Ajax Updates

Ajax Updates


Page Peel Effect Using MooTools

Posted: 26 Oct 2009 10:33 AM PDT

A great script back in May titled Simple Page Peel Effect with jQuery & CSS. The idea is that you place a "peel" image on the upper-right side of an element which, when hovered, "peels" open and peels close. I thought this was a quality, flexible idea so I've ported the jQuery code to MooTools

<div id="page-flip"> 	<a href="http://feeds.feedburner.com/BluDice"><img src="page_flip.png" alt="Subscribe!" id="page-flip-image" /></a> 	<div id="page-flip-message"></div> </div>    

A wrapper DIV containing an image and a "message" DIV.
The CSS

  #page-flip { position:relative; right:0; top:0; float:right;  } #page-flip-image { width:50px; height:52px; z-index:99; position:absolute; right:0; top:0; -ms-interpolation-mode:bicubic; } #page-flip-message { width:50px; height:50px; overflow:hidden; position:absolute; right:0; top:0; background:url(subscribe.png) no-repeat right top; }  

These initial CSS is important as we'll be modifying this initial CSS with MooTools.
The MooTools Javascript

 (function($,$$) { window.addEvent('domready',function() {  	var flip = $('page-flip'); 	var flipImage = $('page-flip-image'); 	var flipMessage = $('page-flip-message');  	flip.addEvents({ 		mouseenter:function() { 			$$(flipImage,flipMessage).set('morph',{ duration: 500 }).morph({ 				width: 307, 				height: 319 			}); 		}, 		mouseleave:function() { 			flipImage.set('morph',{ duration: 220 }).morph({ 				width: 50, 				height: 52 			}); 			flipMessage.set('morph',{ duration:200 }).morph({ 				width: 50, 				height:50 			}); 		} 	}); }); })(document.id,$$);   

The peel effect is triggered by mouseenter and mouseleave events on the outter DIV element. You'd think there was more to it but the effect is driven simply by width and height animations.

   




Demo: http://davidwalsh.name/dw-content/page-flip.php
Source: http://davidwalsh.name/peel-effect

Related Listings:

  1. Page Peel with Jquery Plugin A jquery plugin to implement a page peel effect to...
  2. Create a Thumbnail Gallery with Slick Heading and Caption Effect with jQuery This is a simple jQuery tutorial, but can be extremely...
  3. Dynamic Text Effects – MooTools Dynamic text effects (fade ins, moving text, etc.) can enhance...

jQuery UI Multiselect – Another attempt of a sortable, searchable multiple select widget

Posted: 26 Oct 2009 08:48 AM PDT

It depends on jQuery 1.3 and jQuery UI 1.7. The widget is styleable using Themeroller. It works in an unobtrusive fashion, by just turning html multiple select inputs into a sexier equivalent. There’s no extra markup needed.

* For installation instructions please have a look at the corresponding blogpost
* Source code is available at Github
* In case you are looking for the original version, it has been moved here
* Bleeding Edge Demo is always available here (thanks to Github Pages)

Features

* Search within available options, if there are a lots of them
* Displaying counts of selected and available items
* Select All / Deselect All Buttons
* Dragging items from the available list to the selected list directly
Misc

There are no limitations. Do whatever you want with this plugin. If you did some nice modifications, just let me know (via Github). I’d be happy to include them.




Demo: http://www.quasipartikel.at/multiselect/
Download: http://github.com/michael/multiselect
Source: http://www.quasipartikel.at/multiselect/

Related Listings:

  1. Alternative Select Multiple with Jquery A progressive enhancement to select multiple form elements. It provides...
  2. Tree with Checkbox Tree with CheckBox nodes An extension for Ext.tree.TreeNodeUI to...
  3. jQuery Select Box This is an unobtrusive jQuery plugin that allows you to...

Animate Image Filling Up Using jQuery

Posted: 26 Oct 2009 08:36 AM PDT

Step one requires that you use your decision making skills to figure out what image you want to use. For this example, I have selected a character which I found in this wonderful Vectortuts+ tutorial.

Next we're going to want to drop it in to Photoshop for some basic preparation. We're are going to end up with three images, in order to understand what role each will play, please check out the helpful diagram below.

If any of the following confuses you in any way, take a look at the images I have included in the downloadable files, it should be easier to understand once you see the final products.

What we're looking to get first is a base image (in this case the actual character), which is a simple matter of saving a cropped image to the size you want. If you would like to include a border around your image, as I have in the demo, make sure the background color matches the one you plan to make the border.

We will skip the middle layer for a moment and look at the top image, which will act as a frame. This image is the inverse of the base image, made so only a cutout of the character can peek through.
In Photoshop you will want to CMD (CTRL on Windows) + Click the base image to select it and then hit CMD (CTRL on Windows) + Shift + I to select the inverse. The selected area will be the frame image, which you can color however you would like.

If you want to include a 10px border around your image, similar to the one in the demo add the following step: While your base image is selected hit Select > Modify > Expand and put in your desired border size, then go ahead and select the inverse. You might need to increase your canvas size in order to prevent unwanted cropping.

Finally we need to make the middle layer image, which I have drawn a box around in the layer diagram. This is the image that will slide up/down above the image and create a unique fill effect (aka paint dripping). I will let you be creative here, but I have included two in the attached files for inspiration.
The CSS

You will notice that I've tagged on helpful comments with each relevant element, read them to understand what you are writing.

*{ margin:0; padding:0; } body { text-align: center; background: #A4CAEF; text-align: center; padding: 20px; } /*Container for the image frame aka the top image*/ .frame{ position: absolute; z-index: 2; } /*The container the character goes in for easy placement*/ #dude{ height: 575px; width: 300px; margin: 0px auto; } /*Adds padding around image to make border. Needed only for pngs.*/ img.loadpic{ margin: 10px; } /*Prevents spillover from middle layer moving up*/ #dudecontainer{ position: relative; overflow: hidden; height: 575px; width: 300px; background: #FFF; } /*The middle layer container, hiding base image initially*/ #dudeoverlay{ position: absolute; z-index: 1; } /*White div in #dudeoverlay that fill space the edge image doesn't*/ #dudeblock{ height: 625px; width: 300px; background: #FFF; } /*Image that adds effect the fill, in this case slanted*/ #dudeedge{ height: 90px; width: 300px; background: url('slash.png'); }   

The HTML

This part is straightforward HTML, just take notice of the hierarchy when putting it all together.

  <div id="dude">  <div id="dudecontainer">     <div class="frame">       <img src="dudeframe.png"/>     </div>     <div id="dudeoverlay">        <div id="dudeblock">&nbsp;</div>        <div id="dudeedge">&nbsp;</div>     </div>     <img src="dude.jpg"/>  </div> </div> 

The jQuery

This is by far the easiest cut and paste job ever. Are you ready?

  $(document).ready(function() {  $("#dudeoverlay").stop().animate({top:'-665px'},{queue:false,duration:3500} ); }); 

Boom, it's that easy. Depending on the size of your image you will want to play around with the top attribute, you will want it to be large enough to completely slide the overlay layer off of the base image. Negative numbers make it go up, positive make it go down. Feel free to fool around with the duration too.



Demo: http://buildinternet.com/live/imagefill/
Download: http://buildinternet.com/live/imagefill/imagefill.zip
Source: http://buildinternet.com/2009/06/animate-image-filling-up-using-jquery/

Related Listings:

  1. jQuery Image Stip Working for Obu Web i've found myself spending less time...
  2. Sliding Box Script As part of the design of this site, I’m using...
  3. iPhoto like Image Resize Upon seeing the Fluxiom intro video, I was compelled to...

Vanadium – Simple Intuitive yet powerful client side validation

Posted: 26 Oct 2009 07:57 AM PDT

Vanadium is declarative client-side validation toolkit. These declaration can be done in two different ways:

* Using json structure
This method requires that elements under validation have to have their IDs defined. Granted that, one can declare validation of the form from [example] by including following code:

  var VanadiumRules = {         email: ['required', 'email'],         accept: ['accept'],         desc: ['required']         }   

Using inline markup
This method simply uses special markup in html elements’ class attributes. The markup is very straightforward. It is consists up to three tokens, prepended with special prefix distinguishing the markup from regular CSS names and separate by special separator. The prefix and the separator are customizable and can be any string. The default prefix is : (colon) and the separator is ; (semicolon). The first token, which is mandatory, is validator type name. The second one is the parameter for the validator. E.g. number of characters when length validator is used. The third token is the ID of the html element serving as an advice into which the message informing about validation failure is inserted. Said that, a html for an element being required valid email address with advice of ID adv would look like:

Installation

The installation is dead simple. Just include vanadium.js in header of your HTML after the dependency (jQuery)

    <head>             ...             ...             <script src="/js/vanadium.js" type="text/javascript"></script>             ...             ...         </head>           




Demo: http://vanadiumjs.com/#examples
Download: http://github.com/lambder/Vanadium/raw/master/dist/vanadium-min.js
Source: http://vanadiumjs.com/

Related Listings:

  1. Simple and Clean Form Validation Script The complete example code (form and script) for Form Validation...
  2. Valid8 – An input field validation plugin for Jquery Valid8 solves both simple and complex validation scenarios. Everything from...
  3. jQuery inline form validation Engine When it comes to form validation, it's hard to have...

0 comments:

Post a Comment

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