In general, we need a function, necessarily cross-browser, that performs the following:

  • Left click {action 1}
  • ctrl + left click {action 2}

Can anyone have a ready-made solution? He himself wrote, but fucking IE, as always, spoils the picture, i.e. he doesn't care if you press the key or not :)

    1 answer 1

    My stand: paragraph and button. a simple click on a button hides a paragraph, when you click on a button when you press ctrl - the paragraph is not hidden, but a frame is added (that is, we cancel the usual action). So the code:

    $(function(){ $('button').click(function(event){ $('p').animate({opacity: 'toggle'}, 2000); if(event.ctrlKey == true){//если при щелчке нажата клавиша ctrl $('p').stop(true); //останавливаем анимацию и очищаем очередь $('p').queue('fx', function(){ $(this).css('border', '3px solid green'); //добавляем в очередь новое действие $(this).dequeue('fx'); //удаляем наше действие из очереди }); } }); }); 

    that's all)

    • Thank you, I will try! - DemoS