Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Making a rectangular transparent portion in a image using css and jquery Reply To: Making a rectangular transparent portion in a image using css and jquery

#146355
dgriesel
Participant

I don’t really understand what your last post is all about ;)

But especially when targeting mobile devices, you should prefer CSS animations/transitions to jQuery:

$( "#image" ).click(function() {$(this).addClass("i-like-to-move-it-move-it");})

#image {
    transition: height 1s ease-out;
}
.i-like-to-move-it-move-it {
    height: 600px;
}

If you want to do something after the transition ended, set a timeout or have a look at https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions?redirectlocale=en-US&redirectslug=CSS%2FTutorials%2FUsing_CSS_transitions#Detecting_the_completion_of_a_transition