Forums

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

Home Forums JavaScript Coffeescript nested iterations Re: Coffeescript nested iterations

#129358
TheDoc
Member

I think you’re confused about what `each()` should actually be doing. You want something that looks more like:

$(document).ready ->
$(“.related_products_image”).mouseenter (e) ->
relid = $(e.currentTarget).data(“imageid”)
relatedProduct = $(“#related_” + relid)
relatedProduct.css(“opacity”, 1.0)
$(“.related_products_image”).mouseleave (e) ->
relid = $(e.currentTarget).data(“imageid”)
relatedProduct = $(“#related_” + relid)
relatedProduct.css(“opacity”, 0.4)