HTML:
<div id="panel">
<a href="path_to_image1.jpg" rel="shadowbox[page]">
<img src="scripts/timthumb.php?src=path_to_image1.jpg&w=200&h=20" alt="Image name1" /></a>
</div>
<div id="thumbs">
<a href="path_to_image1.jpg" rel="shadowbox[page]"><img src="scripts/timthumb.php?src=path_to_image1.jpg&w=30&h=30" alt="Image name1" /></a>
<a href="path_to_image2.jpg" rel="shadowbox[page]"><img src="scripts/timthumb.php?src=path_to_image2.jpg&w=30&h=30" alt="Image name2" /></a>
<a href="path_to_image3.jpg" rel="shadowbox[page]"><img src="scripts/timthumb.php?src=path_to_image3.jpg&w=30&h=30" alt="Image name3" /></a>
</div>
JS:
$('#thumbs a').click(function(evt) {
evt.preventDefault();
var clickedElement = $(this).clone();
$('#panel').empty().append(clickedElement);
});
所以这很有效,我只想将点击锚上的图像 src 的 w=30&h=30 更改为 w=200&h=200,然后附加到#panel。