0

I have bit of a fiddly one here but I am basically attempting to put an image swap function into Galleriffic. I have been adapting the jquery Galleriffic image gallery to fit a client's needs and all is going well apart from this one function that I need to add.

http://www.susanyounganimation.com/test/drawings/carnival.html

Beneath the large image on the left is the text 'negative/positive'. The client wants the user to have the option to see a negative i.e. inverted version of the image when one clicks on 'negative' and then the image to revert back to the original when they click positive'. I have every image in the gallery as a negative version (exactly the same dimensions etc) so what I need to do is simply replace the current image with another when one clicks on the negative or positive text beneath.

Hope this all makes sense. Can anyone help me with some script that will enable this? Any comments welcome as I am at my wits end with this one!

All the best

S

4

1 回答 1

0

我不是那个画廊的专家,但我将如何解决这个问题。我会创建负片图像并将它们存储在与主图像相同的文件夹中,并在文件末尾添加一个负片,例如:

绘画-001.jpg

绘画-001-neg.jpg

然后为负和正链接添加一个单击事件处理程序,该处理程序将用相同的图像替换当前的大图像 src,并以“neg-”开头。

$("img#ID_OF_MAIN_IMAGE").src($(this).attr('src').replace('.jpg','-neg.jpg'));

并恢复它:

$("img#ID_OF_MAIN_IMAGE").src($(this).attr('src').replace('-neg.jpg','.jpg'));

您只需要一个正/负链接实例,而不是每张照片一个。

如果不清楚,请告诉我

于 2013-02-15T19:29:19.143 回答