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

  • SEARCH
  • Home
  • 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 9278595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:24:57+00:00 2026-06-18T17:24:57+00:00

Mostly regarding animation; I have several elements with different animations which may be shown

  • 0

Mostly regarding animation;

I have several elements with different animations which may be shown or hidden using their own unique settings; Pop-downs with a slight bounce, menus fading in/out, etc.

Several buttons/widgets/events will hide/show those elements, and I want to avoid having to copy the options in the hide() or show() for each potential call. I also don’t want to need to keep track of a list of default options somewhere; I’d like to just set their animation settings as they are initialized, so any scripts later don’t need to worry about passing in options.

Is there a way to save the default options for select targets? Something like…

$('#foo').setDefaultOptions('hide', {/* New Defaults */});
// or...
$('#foo').hide.defaults = {/* New Defaults */};

So calling the below will just use those options without further input:

$('#foo').hide(); // Uses those default values set earlier

Thank you.

  • 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-18T17:24:58+00:00Added an answer on June 18, 2026 at 5:24 pm

    Use .data() to set the options on the object itself after you’ve created it. Then, create your own version of .hide() and .show() that gets the options from .data().

    // define custom hide function that retrieves default options
    $.fn.myHide = function() {
       this.each(function() {
           var item = $(this);
           item.hide(item.data("animOptions"));
       });
       return this;
    }
    
    // set default options once
    $("#foo").data("animOptions", {...});
    
    
    // from then on, just call the method and it uses the object-specific default options
    $("#foo").myHide();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This mostly theoretical question regarding Android and Java. I want to know which Java
I am reading about EJB Session Bean. I have worked mostly on spring and
I mostly use Eclipse but have mentionned Netbeans on my cv. Are there any
I mostly develop using C#, but I think this question might be suitable for
I have found articles regarding cache behaviour so I can only assume that it's
I've started working on some Android applications and have a question regarding how people
I have been learning and using Objective-C and cocos2d (iOS game-engine) for a couple
I'm using the CSS3 animations from Dan Eden. I'm having troubles to work with
There are pretty many questions regarding C++ GUI toolkits for Windows, but they mostly
We have seen lots of discussion in SO regarding the class vs struct in

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.