click

Detecting middle mouse click event jQuery

廉价感情. 提交于 2019-11-29 13:27:06
I want to show a jQuery-UI dialog box as a popup when user clicks on left mouse button or the middle one. It works for left click (I get the alert box and after that the popup) but doesn't work for middle (neither alert box nor popup). What am I missing? $('a.external').live('click', function(e){ if( e.which <= 2 ) { e.preventDefault(); alert ("inside if"); } popUp.start(this); }); Use mousedown or mouseup instead of click . And (unless you are using a very old version of jQuery) use .on() instead of .live() : $(document).on("mousedown", "a.external", function(e) { if( e.which <= 2 ) { e

Why does fancybox require two clicks activate?

China☆狼群 提交于 2019-11-29 12:54:41
jQuery <script type="text/javascript"> jQuery(document).ready(function () { jQuery("a.fancybox_videojs").click(function(e) { e.preventDefault(); var url = jQuery(this).attr('title'); var rel = jQuery(this).attr('rel'); var img = jQuery(this).children('img').attr('src'); jQuery(this).fancybox({ 'overlayOpacity' : <?php echo get_option('fancybox_overlayOpacity'); ?>, 'overlayColor' : '<?php echo get_option('fancybox_overlayColor'); ?>', 'hideOnContentClick' : false, 'content': '<div><div class="video-js-box vim-css">' + '<video id="example_video_1" class="video-js" width="650" height="370"

委托、事件--事件介绍篇

限于喜欢 提交于 2019-11-29 12:51:45
一、简单的事件介绍 下面将直接在windows应用程序的一个窗体中说明事件的基本规则 using System; using System.Windows.Forms; namespace Forms { public partial class Event : Form { /// <summary> /// 窗体构造器 /// </summary> public Event() { InitializeComponent(); // 使用 += 即是把新方法添加到委托列表中 -- 多播委托 btnOne.Click += new EventHandler (btn_Click); btnTwo.Click += new EventHandler (btn_Click); btnTwo.Click += new EventHandler (btnTwo_Click); // 匿名委托 btnOne.Click += delegate ( object sender, EventArgs e) { labText.Text += "Button one was pressed" ; }; } /// <summary> /// 事件处理函数【没有返回值,命名规则为引发事件对象 _ 事件名】 /// </summary> /// <param name="sender">

jQuery simulate click event on select option

别等时光非礼了梦想. 提交于 2019-11-29 12:36:31
问题 I have a select menu that triggers an AJAX request once one of the options has been clicked. I need to trigger a click event on the relevant option from a link. So I have code similar to the below, and although it changes the value of the select, it doesn't simulate a click: $('#click').click(function(){ var value = $(this).attr("rel"); $('#select').val(value); return false; }); <select id="select" name="select"> <option>Select...</option> <option value="1">Option 1</option> <option value="2"

any way to detect ctrl + click in javascript for osx browsers? no jQuery

蹲街弑〆低调 提交于 2019-11-29 12:34:06
using vanilla js. Any way to grab the "right-click" (option-click) from OSX? function clickey(e) { if(event.button==2 || /*how you'd do it in Java=)*/ e.getButton() == MouseButton.BUTTON3 ) ... } but in js, how do eeet? You need to listen to the contextmenu event. This is triggered when the context menu should be shown. So either if the right mouse butten or or ctrl + mouse . If it is not supported then you can try to check the mousedown event where button is 2 and ctrlKey is true if it is triggered by using ctrl + mouse document.addEventListener("contextmenu",function(event){ }); OR

jQuery .Click() Doesn't Work

。_饼干妹妹 提交于 2019-11-29 11:58:41
I have an external *.js file which contains the following code: $(".hlavni_tema").click(function() { alert("ok"); }); alert("loaded"); and an HTML page, as follows: <div id="tema"> <span id="hlavni_tema_1" class="hlavni_tema">Základní fyzikální pojmy a jednotky</span> <input type="checkbox" name="tema" id="tema_1a" value="'1a'"> <label for="tema_1a">Základní fyzikální pojmy, měření ve fyzice</label> ... <span id="hlavni_tema_8" class="hlavni_tema">Astrofyzika</span> <input type="checkbox" name="tema" id="tema_8d" value="'8d'"> <label for="tema_8d" class="posledni_label">Fyzikální obraz světa<

“Disable” a link temporarily when clicked?

本秂侑毒 提交于 2019-11-29 11:54:15
I have a link that when clicked, performs some animation functions to some divs etc and works very well. My problem is when I click the button more than once etc, the animation looks weird. I would like it so, that when my button is clicked, the button is "disabled" for say 2 seconds. I don't think I need to post the code, but just ask if you think you need it. My link is like so: <a href="button">Click</a> Yes, you can absolutely do this. You add a click handler and use preventDefault() when the animation is running until it is complete. More about preventDefault is in the jQuery docs. You

“Normal” button-clicking approaches are not working in Greasemonkey script?

荒凉一梦 提交于 2019-11-29 11:42:20
Here is the button on the page: <a id="dispatchOnJobButton" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c" href="#" data-role="button" data-theme="c" data-disabled="false"> <span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true"> <span class="ui-btn-text">Dispatch on next job</span> </span> </a> I need Greasemonkey to click it. I tried many different methods, but none seem to fire whatever function it is supposed to run. var clickEvent = document.createEvent("MouseEvents"); clickEvent.initEvent("click", true, true); document.getElementById('dispatchOnJobButton').dispatchEvent

jQuery change CSS after a certain amount of time

拥有回忆 提交于 2019-11-29 11:24:32
I have a navigation that, when one of it's nav items is clicked, will use jQuery to change it's z-index to 0. Then, after 2 seconds, I would like the z-index to be changed to 2. I tried using delay() but apparently that doesn't work when changing the CSS. Use a setTimeout like this $(elem).css('z-index','0'); setTimeout(function(){ $(elem).css('z-index','2'); },2000) In javascript you can use either setTimeout or setInterval to accomplish that setTimeout("javascript statement",milliseconds); http://www.w3schools.com/js/js_timing.asp 来源: https://stackoverflow.com/questions/4411644/jquery-change

bootstrap-table如何给行内添加操作函数及功能按键

眉间皱痕 提交于 2019-11-29 11:09:40
$('#table').bootstrapTable('destroy'); $('#table').bootstrapTable({ // data:reet.data, url:'../data/yonghuguanli.json', // uniqueId: "SOBID", striped:true, pagination:true, clickToSelect:true, height:580, columns: [{ checkbox:true, },{ field: 'id', sortable:true, title: '组织编码', sortable: true, },{ field: 'name', title: '组织名称', sortable: true, },{ field: 'lexing', title: '账套编号', sortable: true },{ field: 'zt', title: '账套名称', sortable: true }, { field: 'operate', title: '操作', align: 'center', events: "operateEvents", formatter: operateFormatter }], }); 2:表格中增加按钮 operateFormatter(value, row,