开发者

make img draggable in td elements

foreach($photos as $photo) {
        $lastChild =开发者_StackOverflow中文版 "";
        if( $count%3 == 0 && $count != 0 )
            echo "</tr><tr>";
        $count++;
        ?> <td>

                <a href="<?php echo ($photo['source'])?>" title="<?php echo      ($photo['name'])?>">   


                <img id="thumb" class="thumb" src="<?php echo ($photo['picture'])?>">
                </a></td>

This is the script for draggable. Ive done this but it still does not work only the first one does the foreach loop affects?

$thumb.draggable({
revert: "invalid", // when not dropped, the item will revert back to its initial position
helper: "clone",
    });

im unable to set ui-draggable to all the img src other than the first img.

any one can help?


Use

<img class="thumb" src="<?php echo ($photo['picture'])?>">

instead of

<img id="thumb" class="thumb" src="<?php echo ($photo['picture']); ?>" />

in your PHP and

$('.thumb').draggable({

instead of

$thumb.draggable({

in your jQuery. This should fix it.

If you absolutely need IDs on the images for any reason, make them unique like this:

<img id="thumb-<?php echo $count; ?>" class="thumb" src="<?php echo ($photo['picture'])?>">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜