JQuery - 画廊的专业帮助(大任务)

时间:2011-01-04 09:58:09

标签: javascript jquery gallery image-gallery html-lists

读得太久了。
这是我的Gallery脚本的核心。这看起来比实际上更复杂..但是我缺乏JQuery(Javascript)知识我无法自己编程。大多数javascript只是伪的,所以如果你可以将伪javascript翻译成实际有效的javascript(Jquery),那就好了。

我有一个展示大图像的图库。我有一个缩略图列表,其中包含用户可以单击以在图库图像之间导航的一些拇指图像。我有一个信息池。它的列表包含Gallery的所有大图像。图库从此信息池中获取其信息。 - 在一些动画问题中我使用了一个看不见的池。

HTML

<div id="gallery">
<ul>
<li>Item 1</li> <--! Item 1 is the standard item that is shown on the page-->
</ul>
</div>

<div id="thumbs">
<ul>
<li>Thumb 1</li> <--! This list contains thumbnails for the gallery-->
<li>Thumb 2</li>
<li>Thumb 3</li>
<li>Thumb 4</li>
</ul>
</div>

<div style="display:hidden;" id="pool"> <-- its invisible for the human eyes -->
<ul> <--! This list is the information pool which stores the big pictures of the gallery-->
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
</div>

Pseudo(JQuery)Javascript

$('#thumbs ul > li).click( function() {
$(this).add the next li from the pool to this list //this snippet is important for me - how do I write this?
});

用户互动,例如 这是它应该如何工作的工作流程 - 我为每个好主意开放以获得结果

用户点击缩略图编号3 脚本从#pool获取第3项 并将其吸引到#gallery(需要Javascript ^^)

看起来像这样:

HTML

<div id="gallery">
<ul>
<li>Item 1</li> <--! Item 1 is the standard item that is shown on the page-->
<li>Item 3</li> 
</ul>
</div>

现在我们动画(我们将800px滚动到第3项)

$(#gallery ul).animate(right: -800);

HTML

<div id="gallery">
<ul>
<li>Item 1</li> <--! Item 1 is the standard item that is shown on the page-->
<li>Item 3</li> <--!The  User will see this big picture now -->
</ul>
</div>

的Javascript

$('#gallery ul li').erase the not see able < li> Item 1 </ li> from the list

应该是这样的:

HTML

<div id="gallery">
<ul>
<li>Item 3</li> <--!The  User will see this big picture now  and Item 1 is gone-->
</ul>
</div>

用户点击拇指2

将第2项从#pool吸引到画廊!但不要把它放在第3项下 - 不要把它放在第3项上面,所以我们可以向左滚动而不是向右滚动

应该是这样的:

HTML

<div id="gallery">
<ul>
<li>Item 2</li> <--! This is putted above < li> Item 3 < /li> -->
<li>Item 3</li> <--!The  User will see this big picture now  and Item 1 is gone-->
</ul>
</div>

现在我们动画(我们将800px滚动到第2项)

$(#gallery ul).animate(right: 800);

用户现在只能看到第2项中的图像

的Javascript

$('#gallery ul li').erase the not see able < li> Item 3 </ li> from the list

应该是这样的:

HTML

<div id="gallery">
<ul>
<li>Item 2</li> <--!The  User will see this big picture now  and Item 3 is gone-->
</ul>
</div>

1 个答案:

答案 0 :(得分:5)

您应该正确对齐代码。

There are很多关于如何执行此操作的jQuery pluginstutorialsSeriouslyliketons