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 7861867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:54:25+00:00 2026-06-02T22:54:25+00:00

I have written a short simple Jquery animation code. Which takes the rel attribute

  • 0

I have written a short simple Jquery animation code. Which takes the rel attribute and uses it for animation inputs for every li.slide.
It works but I feel it may not be the best way to do this. Can it be simplified / optimised or does it not matter?

Thanks

Javascript / Jquery youngster

$('.slide', this).each(function() {
    var rel = $(this).attr('rel');
    var coord = rel.split(',');

    var $delay = parseInt(coord[2]);
    var $transition = coord[3];
    var $duration = parseInt(coord[4]);

    $(this).delay($delay).animate({'background-position-x' : '50%', 'background-position-y' : '0', opacity : '1'},$duration, $transition);

 });

HTML example:

<li class="slide" rel="50%,300px,600,linear,200"></li>
  • 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-02T22:54:27+00:00Added an answer on June 2, 2026 at 10:54 pm

    A smal thing would be to use data-* attribute instead of rel. html5doctor.com

    You could also skip using jQuerys animate function and do all youre calculations outside the animation. Save an array of the calculations and iterate them with setInterval function. This will also open doors for a more creative development that doesn’t only use tweens.

    I have published some work at github that you are free to use. Check out animasies.
    It’s a library of complex calculations ment for animations with a simple interface.

    Update

    Just finished creating a JavaScript that you may use as it is or get inspired by.

    https://github.com/erik-landvall/animator

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this short script (which I've stripped away some minor detail for
I have written a simple app which atm just pops up a toast message
I have some simple jQuery written to sort some elements based on a numerical
I have a problem with a very simple piece of code written in Javascript,
I'm just getting into unit testing, and have written some short tests to check
I have written a packet reader that uses libpcap to read a capture file.
I have written the following code in SWI-Prolog: :- dynamic state_a/1 . :- dynamic
I have written a module that uses vqmod for opencart. How can I check
I have written a simple feedback application in django. It's not particulairly complex, basically
I have written a perl XSUB wrapper for a very simple C API (for

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.