is it possible to animate and remove the pseudo content from a element..?

3gwebtrain

I have a button, when a user click on the button, i am adding a "tick" mark on the button using pseudo content :before, it works fine.

But i need to remove that :before property by fadeOut() with 2sec. is it possible to do that?

here is my button css code:

button{
    border: 1px solid #1f85c3;
    height: 30px;
    color: #fff;
    padding: .4em 1em !important;
    background-image: linear-gradient(#1f96d0, #007cc2);
    position: relative;
    display: block;
    padding-right: 30px !important;
}

on click i am adding a class name right:

button.right:before{
    content: '';
    position: absolute;
    top: 50%;
    right: 0%;
    margin: -7px 0 0 -10px;
    height: 5px;
    width: 16px;
    border: solid #FFF;
    border-width: 0 0 5px 5px;
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    -webkit-box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4);
    box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4);
}

any advice please?

Gabriele Petrioli

Since you are adding the right class on click, you could create an empty :before pseudo-element for the button and use transitions

button:before{
    content:'';
    opacity:1;
    transition:opacity 2s linear;
}

and add opacity:0 to your button.right:before rule.

button.right:before{
    content: '';
    position: absolute;
    top: 50%;
    right: 0%;
    margin: -7px 0 0 -10px;
    height: 5px;
    width: 16px;
    border: solid #FFF;
    border-width: 0 0 5px 5px;
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    -webkit-box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4);
    box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4);

    opacity:0;
}

Demo at http://jsfiddle.net/SYQ89/

(i have only added the standard property for transitions, you should add vendor specific prefixes if required..)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

is it possible to animate and remove the pseudo content from a element..?

From Dev

Is it possible to insert an HTML tag from pseudo-element content using CSS?

From Dev

Is it possible to insert an HTML tag from pseudo-element content using CSS?

From Dev

How to remove element after pseudo-content with jQuery

From Dev

Pseudo element content with JQuery

From Dev

How to inserted HTML tag from pseudo-element content:

From Dev

How to inserted HTML tag from pseudo-element content:

From Dev

disable touch on the pseudo content of an element

From Dev

Is it possible to add variable width pseudo-element content to the /left/ of a div with css?

From Dev

It is possible to add non-latin characters in css content pseudo-element?

From Dev

Unicode in data-content for pseudo element content

From Dev

Use content of an element in attr() of pseudo-element

From Dev

before pseudo-element covering inner content

From Dev

CSS Transition on the 'content' property of :before pseudo element

From Dev

Getting pseudo-element content in Chrome

From Dev

CSS Transition on the 'content' property of :before pseudo element

From Dev

Move content added with pseudo-element:after

From Dev

getComputedStyle from the `before` pseudo element

From Dev

Is it possible to have a :after pseudo element on a button?

From Dev

Is it possible to have an :after pseudo element on a button?

From Dev

XSLT 1.0: Is it possible to remove content inside parenthesis from a string?

From Dev

Animate / Reveal Content From Center

From Dev

Animate / Reveal Content From Center

From Dev

Remove bottom border from :before pseudo element when parent has border

From Dev

Is it possible to remove "Inspect Element"?

From Dev

How can I remove content like   from an element?

From Dev

How to remove element from xml file using text content in java?

From Dev

How do I remove an element and its content from an XML file

From Dev

JQuery animate element height after changing content

Related Related

  1. 1

    is it possible to animate and remove the pseudo content from a element..?

  2. 2

    Is it possible to insert an HTML tag from pseudo-element content using CSS?

  3. 3

    Is it possible to insert an HTML tag from pseudo-element content using CSS?

  4. 4

    How to remove element after pseudo-content with jQuery

  5. 5

    Pseudo element content with JQuery

  6. 6

    How to inserted HTML tag from pseudo-element content:

  7. 7

    How to inserted HTML tag from pseudo-element content:

  8. 8

    disable touch on the pseudo content of an element

  9. 9

    Is it possible to add variable width pseudo-element content to the /left/ of a div with css?

  10. 10

    It is possible to add non-latin characters in css content pseudo-element?

  11. 11

    Unicode in data-content for pseudo element content

  12. 12

    Use content of an element in attr() of pseudo-element

  13. 13

    before pseudo-element covering inner content

  14. 14

    CSS Transition on the 'content' property of :before pseudo element

  15. 15

    Getting pseudo-element content in Chrome

  16. 16

    CSS Transition on the 'content' property of :before pseudo element

  17. 17

    Move content added with pseudo-element:after

  18. 18

    getComputedStyle from the `before` pseudo element

  19. 19

    Is it possible to have a :after pseudo element on a button?

  20. 20

    Is it possible to have an :after pseudo element on a button?

  21. 21

    XSLT 1.0: Is it possible to remove content inside parenthesis from a string?

  22. 22

    Animate / Reveal Content From Center

  23. 23

    Animate / Reveal Content From Center

  24. 24

    Remove bottom border from :before pseudo element when parent has border

  25. 25

    Is it possible to remove "Inspect Element"?

  26. 26

    How can I remove content like   from an element?

  27. 27

    How to remove element from xml file using text content in java?

  28. 28

    How do I remove an element and its content from an XML file

  29. 29

    JQuery animate element height after changing content

HotTag

Archive