I have a problem with a hybrid mobile application.
I would like to change the style of a div when it is clicked. I currently have something like:
<div id="foo">
Lorem ipsum dolor...
</div>
and I apply in my document css:
#foo:active{
background-color: red;
}
However, in my mobile application, when I give quick touches ( quick clicks ) the style does not apply (only applies in long clicks).
What can I do to make the style change by giving quick clicks?
PS:
I have also tried to use a "click" event with javascript, adding and removing a class with different style, however, it only works in the aggregate of the class and when it is removed nothing happens.
css:
.bar{
background-color: red;
}
js:
$$('#foo').click(function(){
$$(this).addClass('bar');
setTimeout(function(){
$$(this).removeClass('bar');
}, 100);
});
Note: $$
refers to the DOM management library that includes Framework7, which I am using