Grow your CSS skills. Land your dream job.

how to make a image vibrate on click ?

  • # January 29, 2013 at 6:49 am

    Hello guys,
    Please help me with this.
    When someone click on a image, then it vibrates..
    :)

    # January 29, 2013 at 6:51 am

    Is that all it’s supposed to do?

    For how long, in what direction, up and down, side to side?

    Do you mean for a smartphone and you want tactile feedback?

    # January 29, 2013 at 7:01 am

    I want the image to vibrate side to side onclick and it vibrates as long as we right click on that image :)

    # January 29, 2013 at 7:02 am

    >Right click

    I think that’s reserved for the OS isn’t it?

    I’m pretty sure you could add a JS click event to animate the image quite easily (I assume you would have a special image class) but right click might be somewhat harder.

    I guess the question we need to ask is why do you want this effect and how would it be used?

    # January 29, 2013 at 7:12 am

    My bad
    ahhhh… i want t to vibrate ion left click
    javascript will work for me :)

    # January 29, 2013 at 7:18 am

    i saw in on a website.
    Tried a hand on it, but wasn’t successful :(

    # January 29, 2013 at 7:26 am

    A CSS animation using translate enabled on :active would be a quick and clean solution. If you want a deeper browser support, then you’ll need JS.

    # January 29, 2013 at 7:43 am

    >i saw in on a website

    What site?

    >Tried a hand on it

    Could you pit what you have in Codepen and let us play with it?

    # January 29, 2013 at 12:29 pm

    what’s &:active? The & specifically

    # January 29, 2013 at 12:33 pm

    @Eric, in SASS, it concatenates the parent element, in this case `img` so it’s technically `img:active`

    # January 29, 2013 at 12:42 pm

    Does SASS work on JS backbone or php?

    # January 29, 2013 at 3:17 pm

    You might find this useful if you’re new to SASS: http://css-tricks.com/video-screencasts/111-get-yourself-preprocessing-in-just-a-few-minutes/ .

    # January 29, 2013 at 5:06 pm

    As soon as Chris had to google how to write a css link I was out. Why would I want to learn a new language? I assume its faster. By what 2 milliseconds?

    # January 29, 2013 at 7:27 pm

    @Eric – once you start using SCSS you’ll never look back. It’s not faster, since it just compiles down to regular CSS, but you’ll *write* faster.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".