javascript - jQuery: click indicator on div -


it may obvious i'm new web development. anyway, i'm trying create click event on div , change background color. want background change original color after click up. here have:

jquery:

$('.details1').click(function() {     $(this).toggleclass('on').delay(200).toggleclass('on'); }); 

css:

div.on {     background: #f78181; } 

i don't want millisecond delay, that's debugging. want change background on click down , up. thanks.

you have use settimeout() function problem instead of delay()

$('.details1').click(function(){         settimeout(function(){ $('#clrd').toggleclass('on'); }, 200);     }); 

you can change time (milliseconds) per need. in case 200ms

check fiddle


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -