• HTML/CSS
  • jQuery
  • PHP
  • JS
  • AJAX
  • MySQL
  • Res
  • XSLT
  • Contact Us
  • HTML/CSS
    • Game Development →
      • HTML5 Game Development - Lesson 1
      • HTML5 Game Development - Lesson 2
      • HTML5 Game Development - Lesson 3
      • HTML5 Game Development - Lesson 4
      • HTML5 Game Development - Lesson 5
      • HTML5 Game Development - Lesson 6
      • HTML5 Game Development - Lesson 7
    • Menus →
      • CSS3 multilevel menu with transition and animation
      • Marble Style CSS3 Navigation Menu
      • Toggle CSS3 Bottom Navigation Bar
      • Accordian like CSS3 Onclick Vertical Navigation
      • Multilevel CSS3 Metal Navigation with icons
      • Click-action CSS3 Dropdown Menu with jQuery
      • Click action Multi-level CSS3 Dropdown Menu
      • CSS3 Animated Menu
      • CSS3/jQuery crossbrowser Drop-down menu with tabs
      • CSS3 Drop sliding list Menu #6
      • CSS3 Slideout Menu #5
      • CSS3 Dropdown Menu #4
      • CSS3 Dropdown Menu #3
      • CSS3 Dropdown Menu #2
      • Cool CSS3 Dropdown Menu
    • Templates →
      • Robo Splash Page Layout
      • 'Mono' HTML5 CSS3 Single Page Layout
      • HTML5/CSS3 single page layout - Art theme
      • Attractive HTML CSS Anime Theme Website Layout
      • HTML CSS website layout #4 - Gray theme
      • Dark and clean HTML CSS website layout
      • HTML5&CSS3 single page layout - Rock portal
      • E-Store HTML5 CSS3 Single Page Layout
      • Under Water Themed HTML5 & CSS3 single page Layout
      • HTML5 & CSS3 Single Page Web Layout
    • HTML5 tutorials →
      • HTML5 Canvas Slideshow
      • HTML5 canvas - Custom brush #2 (Bubble brush)
      • HTML5 canvas - Custom brush (BezierCurveBrush)
      • HTML5 Face Builder
      • Pure HTML5 file upload
      • HTML5 image crop tool
      • HTML5 animation - patterns with loops
      • HTML5 3D circle text with shadows
      • HTML5 canvas pixelate effect
      • Animated Moving Clouds using HTML5
      • Animated Fireplace in HTML5
      • 3D Animated Box HTML5 WebGL Photo Slideshow
      • Your Own Paint Program
      • Image Zoomer in HTML5 Canvas
      • Photo Array in WebGL
      • HTML5 Canvas Image Color Picker
      • HTML5 Image Effects App - Adding Horizontal Flip
      • Keyboard Sensitive 3D Twisted Images in WebGl
      • Animated 3D WebGL Demonstration
      • HTML5 Image Effects App - Adding Noise and Invert
      • HTML5 Canvas Image Effects App - Adding Blur
      • Attractive Presentation with HTML5
      • HTML5 Canvas App for Online Image Enhancements
      • Water Ripple effect using HTML5 canvas
      • Animated 3D canvas object in HTML5
    • CSS3 tutorials →
      • CSS3 Image Hover Effects
      • CSS3 Modal Popups
      • Isometric interactive interior guide
      • Analog Clock with Pure CSS3
      • CSS3 Optical Illusions
      • CSS3 Animated Photo Slider
      • CSS3 Christmas Tree with Snow
      • How to Create a Pure CSS3 Slideshow
      • CSS3 Drop Caps
      • Pure CSS3 Slider
      • Fantastic Animated Buttons using CSS3
      • How to Create a Pure CSS3 Animated Photo Gallery
      • Toggle CSS3 Bottom Navigation Bar
      • How to Generate Runtime Multi-columns with CSS3
      • Multiple backgrounds and Animation with CSS3
  • jQuery
    • Photo album with jQuery Fotorama
    • Photo album with jQuery Chop Slider
    • Cool Background Image Sliding effect with jQuery
    • jQuery Templates - Usage Practice
    • Photo Album with Galleriffic jQuery plugin
    • Fantastic Photo Album with TN3
    • Ajaxy Photo Gallery (jQuery) with Custom Images Sets
    • Rotating Slider with Easing Effects in jQuery
    • Animated jQuery Progressbar Plugin
    • Nice CSS3 Lightbox Gallery
    • Photo Album with Highslide
    • Using Flux Slider jQuery plugin
    • Ajaxy Chained Selects
    • Modern jQuery Pagination for Content
    • Your own jQuery Slider Plugin
    • Attractive Photo Gallery using SmartGallery
    • Animated Photo Gallery using jQuery (Slider Kit)
  • PHP
    • Powerful Chat System - Lesson 3
    • Powerful Chat System - Lesson 2
    • Powerful Chat System
    • Access Control with Bit Masks
    • Own XML/JSON/HTML API with PHP
    • Your Own Ajax Poll System
    • Diary style PHP Guestbook
    • Smooth Curve Graphs with PHP and GD
    • Your Own Commenting System from Scratch
    • Autocomplete with PHP, jQuery, MySQL and XML
    • Your Own 5 Stars Voting System
    • How to use Memcache with PHP
    • How to install APC on Linux
    • How to Use APC Caching with PHP
    • Watermark processing on images using PHP and GD
    • ID3 Tags Reader with PHP
    • Advance Level Login system with Logic captcha
    • Protection and Methodologies of Security Vulnerabilities
    • How to Resize images on Server Side
    • How to Protect any Site from Spam using Akismet
    • Phar - PHP archiving practice
  • JS
    • Form Validation with Javascript and PHP
    • Fullscreen Javascript Slide navigation
    • Photo Scrambler grid in javascript
    • Photo Slideshow (zoom fading) effect
    • Custom scrollbars - cross-browser solution
    • Flare Lens Effect
    • Own RSS Reader Using Google Feed API
    • Cross-browser Wave Effects
    • Cross-browser Supported Image Skew effect
  • Res
    • ← Infographic
      • The Evolution of Languages
    • ← jQuery plugin roundups
      • December 2011
      • November 2011
      • 10 fresh jQuery Tutorials
      • October 2011
      • September 2011
      • 10 fresh Ajax related jQuery plugins
      • August 2011
      • 10 Oven Fresh jQuery Plugins for UI
      • 10 Most creative jQuery plugins for tables
      • 10 Most Creative jQuery Navigation Plugins
      • 10 fresh jQuery plugins for working with forms and UI
      • 10 superb jQuery plugins for working with images
    • ← HTML5 stuff
      • HTML5 and Games
      • 10 Fresh HTML5 Tutorials
      • Fresh impressing WebGL demonstrations
      • Most impressing HTML5 with WebGL demonstrations
      • 10 Fresh & Impressive HTML5 Canvas (and WebGL) Examples
      • 10 Exceptional Examples of HTML5 Canvas and Applications
    • ← Mobile
      • How to start developing own applications for Android
      • 10 Fresh Android tutorials
      • 10 Attractive Tutorials for Developing iPhone Applications
      • 10 Attractive android tutorials for developers
      • 10 Fresh iPad Apps for Web Designers & Developers
      • 10 Fresh Android Apps for Web Designers & Developers
      • 10 Fresh iPhone Apps for Web Designers & Developers
      • Top 10 iPhone apps for working with graphics
    • 12 Unique Navigation Menu Designs For Your Inspiration
    • 15 Unique and Creative Layouts 2011
    • 12 Beautifully Creative Flash Websites of 2011
    • Fresh collection of Original Captchas
  • XSLT
    • Animated forums using XSLT and Ajaxy
    • Multilevel Menu using XSLT
    • Delicious bookmarks using XSLT transformation
    • XPath visually
    • Tags cloud using XSLT transformation
    • Youtube videos using XSLT transformation
  • Contact Us
KEEP IN TOUCH

Easily Animate Web Buttons/Objects using jQuery

Sep08
2010
13 Comments Written by admin

Easily Animate Web Buttons/Objects using jQuery

Today I will tell you about animations in web using jQuery. As we know – jQuery offer us several default methods of effects: fade(In/Out/To), hide, show, slide(Down/Toggle/Up), toggle. This is ok, but what if we need more? So, animation will help us! It will help to slide between 2 states using really good effects. By default, ‘easing’ is optional param, so to use extra effects we will use additional jquery.easing.js library.

Here are samples and downloadable package:

Live Demo
download in package

Ok, download the example files and lets start coding !


Step 1. HTML

As usual, we start with the HTML.

This is our main page code.

index.html

<script src="js/jquery.min.js"></script>
<script src="js/jquery.easing.1.3.js"></script>
<script src="js/main.js"></script>

<link rel="stylesheet" href="templates/css/main.css" type="text/css" />

<div class="animation_example">
    <h3><a href="#">Animation in jQuery</a></h3>
    <div>
        <div style="margin-bottom:10px;">
            <h4>Sample object:</h4>
            <div class="example_keeper">
                <img id="example" src="files/image.jpg"/>
            </div>
            <div class="actions">
                <input type="radio" value="width" checked name="action" class="action"> Changing width
                <input type="radio" value="position" name="action" class="action"> Changing position
                <input type="radio" value="opacity" name="action" class="action"> Changing opacity
                <select class="selector"></select>
            </div>
        </div>
        <p>
            <b>An example of animations.</b> I made 3 different types of animations: changing size (width), position and opacity. Also I pull all possible effects of easing into Select element. Just choose necessary type and select effect to get demonstration. Try it!
        </p>
    </div>
</div>

Step 2. CSS

Here are used CSS styles.

templates/css/main.css

body{background:#eee;font-family:Verdana, Helvetica, Arial, sans-serif;margin:0;padding:0}
.animation_example{background:#FFF;width:865px;font-size:80%;border:1px #000 solid;margin:0.5em 10% 0.5em;padding:1em 2em 2em;-moz-border-radius: 3px;-webkit-border-radius: 3px}
.actions{margin:10px 0}
.example_keeper{overflow: hidden;width:100%;height:520px;border:1px solid #DDD;background-color:#eee}

Step 3. JS

Here are necessary JS files to our project.

js/main.js

$(document).ready(function() {
    var sel1 = $(".selector");
    for (x in jQuery.easing) { // collecting all possible methods of easing
        sel1.append($('<option>').attr('value', x).text(x));
    }

    sel1.change(function(){
        var method = $(this).val();
        var effect = $('input[name=action]:checked').val();

        switch (effect) {
            case 'width':
                $('#example').animate({width:512}, {duration: 1000, easing: method})
                    .animate({width:256}, {duration: 1000, easing: method});
                break;
            case 'position':
                $('#example').animate({marginLeft:256}, {duration: 1000, easing: method})
                    .animate({marginLeft:0}, {duration: 1000, easing: method});
                break;
            case 'opacity':
                $('#example').animate({opacity:0}, {duration: 1000, easing: method})
                    .animate({opacity:1}, {duration: 1000, easing: method});
                break;
        }
    });
});

js/jquery.easing.1.3.js and js/jquery.min.js

This is common files – jQuery library with addon. No need to give full code of that file here. It always available as a download package

Step 4. Images

Also we need source image for our project:

    source image

Live Demo
download in package

Conclusion

Today I told you how using animations in jQuery. Sure that you will happy to use it in your projects. Good luck!

About: admin:
I am web developer with huge experience (in web languages and even in system languages). Also I am the founder of current website (and several another). I like to write blogs about web development/design. Feel free to Follow us on Twitter: tweetmeme_screen_name='AramisGC';
If you Enjoyed our article don't forget to Share the love with your friends.
    Tweet
   
   
Written by: admin on September 8, 2010.

Related Stuff You Will Love!

  1. Creating a Rotating Slider with Easing Effects in jQuery
    Creating a Rotating Slider with Easing Effects in jQuery
  2. Positioning Backgrounds with Jquery
    Positioning Backgrounds with Jquery
  3. Easily Interact between Server and Client using these jQuery with Ajax Snippets
    Easily Interact between Server and Client using these jQuery with Ajax Snippets
  4. Jquery CSS Tutorial on Zooming Image
    Jquery CSS Tutorial on Zooming Image
Posted in HTML/CSS, JavaScript, jQuery - Tagged animation, animation web objects, css, easing, effects, jQuery
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
« Cropping images in runtime using Jcrop (jQuery)
» How to create captcha in PHP using GD library

2 Comments

  1. Issac Maez's GravatarIssac Maez
    September 17, 2010 at 8:07 am | Permalink

    Seriously happy i found this website, will make sure to take a note of it so i can come to routinely.

  2. Astigmatism's GravatarAstigmatism
    September 19, 2010 at 12:57 am | Permalink

    It is useful to try everything in practice anyway and I like that here it’s always possible to find something new. Greetings from Michigan

3 Trackbacks

  1. Easily Animate Web Buttons/Objects using jQuery | Scriptsnthings.com on September 15, 2010 at 5:46 am
  2. kids toys on October 4, 2010 at 8:38 pm
  3. halifax escorts on November 22, 2010 at 4:54 pm
  4. escort owen sound on November 23, 2010 at 1:51 am
  5. 35 jQuery Animate Tutorials | webdesign14.com on January 27, 2011 at 7:24 am
  6. 35 jQuery Animate Tutorials | webdesign14.com on January 27, 2011 at 7:24 am
  7. 55个 jQuery 动态效果资源 | 百锐网 on May 20, 2011 at 6:35 am
  8. 55 Great jQuery Animation Resources on June 26, 2011 at 1:00 pm
  9. 20 Efectos para jQuery basados en animaciones on June 27, 2011 at 5:27 pm
  10. 22 Useful jQuery Animation Tutorials | AcrisDesign on August 2, 2011 at 9:03 am
  11. 22个有用的JQ动画教程 | uleadesign 领潮社 on December 6, 2011 at 6:17 am

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

CAPTCHA Image
Refresh Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Popular Tutorials

  • How to create easy pagination with jQuery
  • Animated jQuery Progressbar Plugin
  • Pure HTML5 file upload
  • Creating a HTML5 & CSS3 Single Page Web Layout
  • HTML5 Game Development – Lesson 6
  • How to Create Animated Photo Gallery using jQuery (Slider Kit)
  • Developing Your First HTML5 Game – Lesson 1
  • How to Easily Make a PHP Chat Application

Tags

3d AJAX android animated animation app application applications apps canvas captcha chat system coding creating css css3 developers effect effects flash fresh gallery how-to html html5 image images iphone javascript jQuery layout menu navigation new photo PHP plugin plugins slideshow system tutorial tutorials webgl website xslt

Recent Tutorials

  • Infographic: The Evolution of Languages
  • 12 Unique Navigation Menu Designs For Your Inspiration
  • Form Validation with Javascript and PHP
  • 10 fresh jQuery plugins (january 2012)
  • Powerful Chat System – Lesson 3
  • Invoicera offer results
  • CSS3 Image Hover Effects
  • HTML5 Canvas Slideshow

Friends

  • X-Musics

Tutorials for Web Developers Copyright © 2009-2011 Script tutorials · All rights reserved