Array of different id with laravel
I’m trying to make an arrangement, to go through the different ids I have. I use lavarel, but I do not know how to pass the values to javascript, just like traversing the array, I know very little about javascript, I know little jquery. I do not know what to do, I hope you can help me.
This is HTML.
@foreach($products as $product)
<div class="product">
<div id="">
<div class="shadow"></div>
<img src="" alt="" />
<div class="image_overlay"></div>
<div class="stats">
<div class="stats-container">
<span class="product_price"></span>
<span class="product_name"></span>
<p></p>
<div class="product-options">
<a href="">Ver</a>
<form action="" method="POST">
<input type="hidden" name="id" value="">
<input type="hidden" name="name" value="">
<input type="hidden" name="price" value="">
<button type="submit" class="button button-plain">Add</button>
</form>
</div>
</div>
</div>
@endforeach
This is Javascript
$(document).ready(function(){
// Lift card and show stats on Mouseover
var elms = document.querySelectorAll("[id='']");
for(var i = 0; i < elms.length; i++)
elms[i].hover(function(){
elms[i].addClass('animate');
$('div.carouselNext, div.carouselPrev').addClass('visible');
}, function(){
elms[i].removeClass('animate');
$('div.carouselNext, div.carouselPrev').removeClass('visible');
});
});
If I leave the id statically, it works. But if I try to do dynamic does not work, I need to be dynamic or to show the different products.
from Laravel Questions and Answers https://laravelquestions.com/php/array-of-different-id-with-laravel/
via Lzo Media
No comments:
Post a Comment