双击图像功能

时间:2014-03-31 04:19:27

标签: javascript jquery tumblr

有人可以帮我创建一个简单的脚本,当有人双击图片时,按钮{LikeButton color =" grey"}将被激活,然后心脏图片会褪色。

这是我的照片块部分代码:

{block:Photo}<div class="containerimg">

                <span class="font-a"><a href="{Permalink}">{block:Date} {Month} {DayOfMonth}, {Year}{/block:Date}</a><br/><a href="{Permalink}">{NoteCountWithLabel}</a><br/>{block:HasTags} {block:Tags} <a href="{TagURL}">#{Tag}</a> {/block:Tags} {/block:HasTags}</span>

                    <div class="post photo">
                        <img src="{PhotoURL-500}" alt="{PhotoAlt}"/>

                        {block:Caption}
                            <div class="caption">{Caption}</div>
                        {/block:Caption}


                    </div>

                    <div class="status">
                    {block:RebloggedFrom} 
                    <img src="{ReblogParentPortraitURL-24}" style="border: 1px solid rgba(0,0,0,.15);" /> <a href="{ReblogParentURL}" style="position: absolute; padding: 5px 0px 0px 10px;">{ReblogParentName}</a>
                    {/block:RebloggedFrom}
                    {block:NotReblog} 
                    <img src="{PortraitURL-24}" style="border: 1px solid rgba(0,0,0,.15);" /> <a href="{Permalink}" style="position: absolute; padding: 5px 0px 0px 10px;">{Name}</a>
                    {/block:NotReblog}

                    <div class="reblogg">
                    {LikeButton color="grey"}&nbsp;&nbsp;{ReblogButton color="grey"}
                    </div>
                    </div>

                    </div>

                {/block:Photo}

2 个答案:

答案 0 :(得分:0)

您可以尝试使用dblclick,如下所示:

$(document).ready(function(){
    $('img').dblclick(function(){
        // do something
        alert('Picture fade out...')
        $(this).fadeOut().slow();
    });
});

You can try it here on jsfiddle

答案 1 :(得分:0)

试试这个:

 $('#yourPictureID').dblclick(function{ 
   $('#LikeButtonID').attr("disable","false");
   $('#heartPictureID').css("opacity","1");
 });