jQuery Custom Gallery and jCarousel problem

↘锁芯ラ 提交于 2020-01-06 02:18:08

问题


Active site can be seen here: http://www.studioimbrue.com/index2.php

There are currently two small problems with the coding. First: when the page loads and you attempt to click on one of the large images to advance, nothing happens. Once a thumbnail is clicked, the click functionality of the large image comes available. I'm trying to fix it so when the page loads, the user can just start clicking the large image.

Second: when an image is clicked, the thumbnail highlight changes. The only problem there is once it gets past 4, the "current" thumbnail needs to be seen, thus the carousel should go to that one. Right now the code for that is nextThumb.closest('.thumbscontainer').jcarousel('next'); but that makes it scroll every time you click. Thanks for any help


回答1:


You put the $('.container .captions li').click(...) code inside the thumbnails' click handler, so the click event for the full image is only added after the first thumbnail is clicked.

You should put that block (including its closing });) outside the other click handler.

Also, you should change

var nextThumb = nextLi
    .closest('.thumbscontainer')
    .find('.thumbscontainer li:eq(' + nextLi.index() + ')');

to .closest('.container').



来源:https://stackoverflow.com/questions/2710772/jquery-custom-gallery-and-jcarousel-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!