0

I have this css class toggling in jQuery inside a function (credits to @Laurence for the code):

function rocksType_shift(direction) {
    $('#rocksType_DBitems_container .before').removeClass('before')[direction]().addClass('before');
          $('#rocksType_DBitems_container .current').removeClass('current')[direction]().addClass('current');
          $('#rocksType_DBitems_container .after').removeClass('after')[direction]().addClass('after');
}

Entire context - fiddle.

The classes have this configuration:

/* CSS styling for the 1st visible item (before) */
.before {
  background-color: Aquamarine;
  -webkit-border-radius: 70px 24px 24px 24px; 
    -moz-border-radius: 70px 24px 24px 24px;       
    border-radius: 70px 24px 24px 24px;
}

/* CSS styling for the 2nd visible item (current) */
.current {
  background-color: Aqua;
  border: 4px solid #000000; 
    -webkit-border-radius: 24px 24px 24px 24px; 
    -moz-border-radius: 24px 24px 24px 24px; 
    border-radius: 24px 24px 24px 24px;
}

/* CSS styling for the 3rd visible item (after) */
.after {
  background-color: Aquamarine;
  -webkit-border-radius: 24px 24px 24px 70px; 
    -moz-border-radius: 24px 24px 24px 70px; 
    border-radius: 24px 24px 24px 70px;

Question: I want to use animate(), so I can animate the border-radius. Can this be done?

Pedro

2
  • I think you need to have a look at jQuery css hooks to handle browser name prefixed properties like -moz-border-radius. You could still try to animate the border-radius property, but all browsers that are not fully CSS3 compatible will fail. What do you want to animate exactly ? Depending on what you want to do, it can be done using CSS3 transitions and/or animations. Commented Apr 12, 2013 at 17:34
  • You can using step option of animate but take into consideration Virus721's comment Commented Apr 12, 2013 at 17:39

1 Answer 1

1

I know you said you want it to be with animate(), but since you already use CSS3, why don't you just do it by adding transition to .rocksType_DBitem ?

http://jsfiddle.net/vNxeY/1/

Sign up to request clarification or add additional context in comments.

2 Comments

Correct, it's really better to use css3
My problem is with IE8 - it doesn't work... and I'm getting to the conclusion that it will never work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.