Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8022273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:13:14+00:00 2026-06-04T22:13:14+00:00

I created a jQuery plugin to add simple CSS animations on Hover but unfortunately

  • 0

I created a jQuery plugin to add simple CSS animations on Hover but unfortunately it only applies to items in the page with the .animate class applied to them. How can I make this apply to the object itself? instead of a set class or id. Please help.

(function($){
   $.fn.extend({

     animate: function(options) {


        var defaults = {
           animation: 'bounce'
        };

        var options = $.extend(defaults, options);

        return this.each(function() 
        {
            var o = options;

            var obj = $(this);

            var animation = o.animation;

  obj.hover(function()         
  {

  switch(animation){
    case 'bounce':
          $(".animate").addClass('bounce');
          break;
    case 'shake':
          $(".animate").addClass('shake');
          break;
    case 'flash':
           $(".animate").addClass('flash');
          break; 
    case 'tada':
           $(".animate").addClass('tada');
          break;
    case 'swing':
           $(".animate").addClass('swing');
          break;
    case 'wobble':
           $(".animate").addClass('wobble');
          break;
    case 'wiggle':
           $(".animate").addClass('wiggle');
          break;
    case 'pulse':
           $(".animate").addClass('pulse');
          break;
    case 'flip':
           $(".animate").addClass('flip');
          break;
    case 'flipInX':
           $(".animate").addClass('flipInX');
          break;
    case 'flipOutX':
           $(".animate").addClass('flipOutX');
          break;
    case 'flipInY':
           $(".animate").addClass('flipInY');
          break;
    case 'flipOutY':
           $(".animate").addClass('flipOutY');
          break;
    case 'fadeIn':
           $(".animate").addClass('fadeIn');
          break;
    case 'fadeInUp':
           $(".animate").addClass('fadeInUp');
          break;
    case 'fadeInDown':
           $(".animate").addClass('fadeInDown');
          break;
    case 'fadeInLeft':
           $(".animate").addClass('fadeInLeft');
          break;
    case 'fadeInRight':
           $(".animate").addClass('fadeInRight');
          break;
    case 'fadeInUpBig':
           $(".animate").addClass('fadeInUpBig');
          break;
    case 'fadeInDownBig':
           $(".animate").addClass('fadeInDownBig');
          break;
    case 'fadeInLeftBig':
           $(".animate").addClass('fadeInLeftBig');
          break;
    case 'fadeInRightBig':
           $(".animate").addClass('fadeInRightBig');
          break;
    case 'fadeOut':
           $(".animate").addClass('fadeOut');
          break;
    case 'fadeOutUp':
           $(".animate").addClass('fadeOutUp');
          break;
    case 'fadeOutDown':
           $(".animate").addClass('fadeOutDown');
          break;
    case 'fadeOutLeft':
           $(".animate").addClass('fadeOutLeft');
          break;
    case 'fadeOutRight':
           $(".animate").addClass('fadeOutRight');
          break;
    case 'fadeOutUpBig':
           $(".animate").addClass('fadeOutUpBig');
          break;
    case 'fadeOutDownBig':
           $(".animate").addClass('fadeOutDownBig');
          break;
    case 'fadeOutLeftBig':
           $(".animate").addClass('fadeOutLeftBig');
          break;
    case 'fadeOutRightBig':
           $(".animate").addClass('fadeOutRightBig');
          break;
    case 'bounceIn':
           $(".animate").addClass('bounceIn');
          break;
    case 'bounceInUp':
           $(".animate").addClass('bounceInUp');
          break;
    case 'bounceInDown':
           $(".animate").addClass('bounceInDown');
          break;
    case 'bounceInLeft':
           $(".animate").addClass('bounceInLeft');
          break;
    case 'bounceInRight':
           $(".animate").addClass('bounceInRight');
          break;
    case 'bounceOut':
           $(".animate").addClass('bounceOut');
          break;
    case 'bounceOutUp':
           $(".animate").addClass('bounceOutUp');
          break;
    case 'bounceOutDown':
           $(".animate").addClass('bounceOutDown');
          break;
    case 'bounceOutLeft':
           $(".animate").addClass('bounceOutLeft');
          break;
    case 'bounceOutRight':
           $(".animate").addClass('bounceOutRight');
          break;
    case 'rotateIn':
           $(".animate").addClass('rotateIn');
          break;
    case 'rotateInDownLeft':
           $(".animate").addClass('rotateInDownLeft');
          break;
    case 'rotateInDownRight':
           $(".animate").addClass('rotateInDownRight');
          break;
    case 'rotateInUpLeft':
           $(".animate").addClass('rotateInUpLeft');
          break;
    case 'rotateInUpRight':
           $(".animate").addClass('rotateInUpRight');
          break;
    case 'rotateOut':
           $(".animate").addClass('rotateOut');
          break;
    case 'rotateOutDownLeft':
           $(".animate").addClass('rotateOutDownLeft');
          break;
    case 'rotateOutDownRight':
           $(".animate").addClass('rotateOutDownRight');
          break;
    case 'rotateOutUpLeft':
           $(".animate").addClass('rotateOutUpLeft');
          break;
    case 'rotateOutUpRight':
           $(".animate").addClass('rotateOutUpRight');
          break;
    case 'lightSpeedIn':
           $(".animate").addClass('lightSpeedIn');
          break;
    case 'lightSpeedOut':
           $(".animate").addClass('lightSpeedOut');
          break;
    case 'hinge':
           $(".animate").addClass('hinge');
          break;
    case 'rollIn':
           $(".animate").addClass('rollIn');
          break;
    case 'rollOut':
           $(".animate").addClass('rollOut');
          break;                                                                                                                              
  }
   $(".animate").addClass('animated');
},

function()
{
    $('.animate').removeClass('animated bounce bounceIn bounceInDown bounceInLeft bounceInRight bounceInUp bounceOut bounceOutDown bounceOutLeft bounceOutRight bounceOutUp fadeIn fadeInDown fadeInDownBig fadeInLeft fadeInLeftBig fadeInRight fadeInRightBig fadeInUp fadeInUpBig fadeOut fadeOutDown fadeOutDownBig fadeOutLeft fadeOutLeftBig fadeOutRight fadeInRightBig fadeOutUp fadeOutUpBig flash flip flipInX flipInY flipOutX flipOutY lightSpeedIn lightSpeedOut pulse rollIn rollOut rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rotateOut rotateOutDownLeft rotateOutDownRight rotateOutUpLeft rotateOutUpRight shake swing tada wiggle wobble');
});              

        });

    }
});
})(jQuery);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:13:15+00:00Added an answer on June 4, 2026 at 10:13 pm

    You can use this to refer to itself, note that you don’t have to do $(this), since inside this is already referring to a jQuery object; from the docs:

    (function( $ ){
    
      $.fn.myPlugin = function() {
    
        // there's no need to do $(this) because
        // "this" is already a jquery object
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created this simple plugin to add multiple animations on click but the problem
I'm using the plugin http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ to create tooltips with JQuery but I can't created
I created a jQuery plugin but I have a problem, I use the following
I have created a jquery plugin to expand/collapse ul,li something like a accordion menu
I am new to jQuery plugin creation and created a plugin for my project
A while back I created a lightbox plugin using jQuery that would load a
I am using the jQuery Tools Scrollable plugin - http://flowplayer.org/tools/scrollable.html#navigator I have created a
I'm having an issue using the qTip plugin with jQuery. I've created a js
I wanted to create jquery plugin & started off creating a sample jquery plugin...But
everytime my page loads, im supposed to create a datatable (also a jquery plugin)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.