I'm trying to do a zoom on hover in my list of products. If I do a long press on a product it works, but only the first time. The second time I do a long press it doesn't work because the div
is on hover state I think.
I want that it works on a mobile phone, the app is built on Cordova and Angular.
How can I resolve this problem?
Here is my code
<div id="endtouch" class="container-fluid">
<div class="conte_product_view_ind" *ngFor="let product of items_list" (mouseover)="opencard(product)">
<a style="text-decoration: none; color: #000;" (click)="opencard(product)">
<img id='img-{{product.id}}' class="lazyload col_img_prod_ind" data-src="{{product.smallImage}}"
alt="{{product.title}}" style="min-height: 200px;">
<div class="conte_datos_general_product-view" id='title-{{product.id}}'>
{{product.title.toLowerCase().charAt(0).toUpperCase() + product.title.toLowerCase().slice(1)}}
</div>
<div class="conte_price" id='price-{{product.id}}'>
{{getInteger(product.price)}} <span class="conte_price_decimal">€{{getDecimal(product.price)}} </span>
</div>
</a>
</div>
</div>
opencard(product) {
console.log('entra');
this.click = false;
this.cardToShow = product;
setTimeout(() => {
if (this.click == false) {
this._renderer.setStyle(this.card.nativeElement, 'display', 'block');
setTimeout(() => {
this._renderer.setStyle(this.productcard.nativeElement, 'transform', 'translate(0%,60%) scale(1.5)');
}, 100);
document.body.appendChild(this.card.nativeElement);
} else {
this._router.navigate(['/comprar-producto/' + product.title.trim().split(' ').join('-') + '/' + product.id]);
}
}, 400);
}
closecard() {
this._renderer.setStyle(this.productcard.nativeElement, 'transform', 'translate(0%,60%)');
setTimeout(() => {
this._renderer.setStyle(this.card.nativeElement, 'display', 'none');
this.cardToShow = {
price: null,
smallImage: null,
title: "",
};
}, 250);
}
onload() {
var element = document.getElementById('endtouch');
element.addEventListener('touchend', this.process_touchend, false);
}
private process_touchend = (ev) => {
setTimeout(() => {
this.click = true;
this.closecard();
}, 100);
}