【发布时间】:2017-10-23 07:06:28
【问题描述】:
我正在处理产品列表页面,更多产品加载了无限滚动。问题是加载新页面时,加载页面上的“产品缩略图”上的点击事件将不会执行。通过单击产品的缩略图,图像必须交换。 我这里使用的 Carousel 是 jcarousel。
提前致谢
无限卷轴:
$(document).ready ->
$("#home-products").infinitescroll
navSelector: "nav.pagination"
nextSelector: "nav.pagination a[rel=next]"
itemSelector: "#home-products #products"
下面是在新加载的页面中执行的onclick函数
$('.product .v-color').on 'click', (e)->
e.preventDefault()
$this = $(@)
$product = $this.closest('.product')
$product.find('.v-color').removeClass('active')
number = $this.data('carousel-number')
$product.find('.carousel').carousel(number)
$this.addClass('active')
changePrice($product, $this.data('price'), $this.data('soldout'),
$this.data('backorderable'))
【问题讨论】:
标签: javascript jquery ruby-on-rails coffeescript