English 中文(简体)
如果烟 the右 but(压抑)
原标题:Do something in hover if the right button of the mouse is down (pressed)

当摩擦超过图像时,我需要把图像分解成像,并保持烟雾右侧。 例如:

$( img ).hover(
     function(){
       if (the-right-mouse-button-is-pressed){
         $(this).animate({
         width:  $(this).width() *2,
         height: $(this).height()*2,
         }, 500);
       }
     },
});

我需要帮助。 感谢。

问题回答

Edit: For your below comment,

Thanks. However, it requires a right-click on the picture. it does not work if you keep the right button down somewhere else in the screen and then pass the image

你们需要有条件地增加 mo和zo。 见以下代码:

var hasExpanded = false;
$( img ).on( mousedown mouseup , function(e) {
    if (e.which == 3) {
            if (!hasExpanded) {
            $(this).animate({
                width: $(this).width() * 2,
                height: $(this).height() * 2,
            }, 500);
        }
        hasExpanded = true;
    }
}).mouseleave(function(e) {
    if (hasExpanded  == true) {
    $(this).animate({
        width: $(this).width() / 2,
        height: $(this).height() / 2,
    }, 500);
    hasExpanded = false;
}
});

不能通过 h子实现你们所需要的目标。 将在<条码>中查询。 只字不提一次,无法记录后来发生的<代码>Mousedown事件。

您需要执行<条码>中途<>。 见下文。

rel=“nofollow>>DEMO/strong> - 安装了<代码>Mousedown和mouseleave

$( img ).mousedown(function(e) {
    if (e.which == 3) {
        $(this).animate({
            width: $(this).width() * 2,
            height: $(this).height() * 2,
        }, 500);
    }
});




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...