0

我正在使用 twitter 引导轮播,

当用户从轮播中选择一个项目并且我想让尺寸更大时,

例如像这样:

在此处输入图像描述

我有这样的html:

<ul class="thumbnails" data-bind="foreach: AchievementItem">
    <li class="span3">
        <div class="thumbnail" tabindex="1">
            <div data-bind="click: $root.GetAchievement">
                <img data-bind="attr: { src: ImageFileName, id: 'thumbnail' + Soid }" src="../Images/DefaultPhoto.png" id="thumbnail521dfe57d94eaf0900bf5355">
            </div>
            <img src="../Images/trashIcon.png" class="trash" data-bind="attr: { id: 'trash' + Soid }, click: $root.DeleteAchievement" id="trash521dfe57d94eaf0900bf5355">
        </div>
        <div class="caption">
             <h5 data-bind="attr: { title: Title, id: 'caption' + Soid }, text: Title" title="Achievement 005" id="caption521dfe57d94eaf0900bf5355">Achievement 005</h5>

        </div>
    </li>
    <li class="span3">
        <div class="thumbnail" tabindex="1">
            <div data-bind="click: $root.GetAchievement">
                <img data-bind="attr: { src: ImageFileName, id: 'thumbnail' + Soid }" src="../Images/DefaultPhoto.png" id="thumbnail521dfe56d94eaf0900bf5354">
            </div>
            <img src="../Images/trashIcon.png" class="trash" data-bind="attr: { id: 'trash' + Soid }, click: $root.DeleteAchievement" id="trash521dfe56d94eaf0900bf5354">
        </div>
        <div class="caption">
             <h5 data-bind="attr: { title: Title, id: 'caption' + Soid }, text: Title" title="Achievement 004" id="caption521dfe56d94eaf0900bf5354">Achievement 004</h5>

        </div>
    </li>
    <li class="span3">
        <div class="thumbnail" tabindex="1">
            <div data-bind="click: $root.GetAchievement">
                <img data-bind="attr: { src: ImageFileName, id: 'thumbnail' + Soid }" src="../Images/DefaultPhoto.png" id="thumbnail521dfe56d94eaf0900bf5353">
            </div>
            <img src="../Images/trashIcon.png" class="trash" data-bind="attr: { id: 'trash' + Soid }, click: $root.DeleteAchievement" id="trash521dfe56d94eaf0900bf5353">
        </div>
        <div class="caption">
             <h5 data-bind="attr: { title: Title, id: 'caption' + Soid }, text: Title" title="Achievement 003" id="caption521dfe56d94eaf0900bf5353">Achievement 003</h5>

        </div>
    </li>
</ul>

因此,当用户单击<li>元素时,我想让该 li elemeent 宽度和 hightbigger 以及其他项目正常,

4

1 回答 1

2

如果您想要缩放功能,那么您可以animate在图像上使用该功能。

$("img").click(function() {
    //Normalize all <li>
    $("img").animate({width: "150px", height: "50px"}, "slow");

    //Make clicked <li> larger
    $(this).animate({width:"50%", height:"50%"}, "slow");
});

JSFiddle:http: //jsfiddle.net/ud2r4/2/

于 2013-08-28T14:32:59.397 回答