dom-events

plupload smartphone and tablet browse button event not firing

别来无恙 提交于 2019-12-05 21:41:30
I use plupload on a metronic bootstrap framework. On desktop it's working fine but on smartphone or tablet, my browse button is not opening the window to select files. <div class="col-md-8"> <div id="engine"></div> <div id="dev_uploader"> <div id="filelist"></div> </div> <a id="addImg" class="btn btn-bg btn-block"><i class="fa fa-plus"></i> add attachement</a> here is the plupload script : jQuery(function() { var uploader = new plupload.Uploader({ runtimes : 'html5,flash,silverlight,gears', browse_button : 'addImg', container : 'dev_uploader', drop_element : 'dev_uploader', max_file_size :

event.pageX not working in Firefox, but does in Chrome

孤者浪人 提交于 2019-12-05 21:36:00
I am having what I thought was a simple problem, but after about a week of searching for the solution I can't seem to find the reason behind it. Basically I am calling the function below every time the mouse is clicked, and it works fine in Chrome, but in Firefox the alert("This is not called") never gets called. I know the problem is in the two lines of code: x = event.pageX - canvas.offsetLeft; y = event.pageY - canvas.offsetTop; but can't seem to find whats wrong. Mozillas site says that event.pageX is a legitimate command to call, and as well the canvas.offsetLeft . But the function still

How do I synthesize a browser click event on a DIV element?

梦想的初衷 提交于 2019-12-05 18:33:17
With buttons, I can call the click() method on them to have a click generated. DIVs however don't have this method on all browsers. Yet I can attach click event listeners to them (by either setting .onclick="..." or adding an event listener). Is there any way for me to "synthesize" a click on such an element programmatically, but without using jQuery ? Ideally this will not be dependent on a specific way of the listeners being registered (so simply calling eval(div.onclick) will not work for me), and work in all modern browsers. (For the curious, I need this for automated testing, not tricking

How to get screen XY from Google maps (V3) LatLng?

瘦欲@ 提交于 2019-12-05 17:21:58
I have polyline in my map. I want to know the pixel (screen) xy-coordinates, when user clicks the polyline. Click event only returns the LatLng object, so does anyone have a clue how to get the pixel coordinates from latLng? I would appreciate very much if someone could help me! If you have the LatLng object, you can use the google map projection object to transform it into tile coordinates and then into pixel coordinates: For the docs on the projection class: https://developers.google.com/maps/documentation/javascript/reference#Projection Google's example explaining how to transform a LatLng

How to hook IE keyboard event?

自闭症网瘾萝莉.ら 提交于 2019-12-05 15:06:09
I am trying to disable browser shortcuts while user tries to press some combination of keys on the swf file. Although I can achieve this in Firefox, below code does not function in IE 8. Below code is able to hook the keyboard events if focus is not on the swf file. However, what I need is hooking keyboard events when user operates on swf file. function hookKeyboardEvents(e) { alert("hooked key"); // get key code var key_code = (window.event) ? event.keyCode : e.which; // case :if it is IE event if (window.event) { if (!event.shiftKey && !event.ctrlKey && !event.altKey) { window.event

Real world example where event capturing is necessary / preferred?

依然范特西╮ 提交于 2019-12-05 14:15:30
The addEventListener DOM method supports a third optional, boolean parameter (useCapture) to indicate whether the function should use event bubbling or event capturing as propagation method. In this article the difference is nicely shown (click on the examples & view code). From other questions on SO and blog posts, I concluded event bubbling was preferred mostly because IE8- didn't support it. Suppose I'm only required to support IE9+, in what situation would event capturing be necessary or preferred over event bubbling? In other words, in what situation would it be better to let the events

Chrome - Javascript prevent default Ctrl + MouseWheel behavior

老子叫甜甜 提交于 2019-12-05 13:34:17
I'm trying to prevent the default Ctrl + MouseWheel zoom behavior in Chrome with JavaScript, for the other browsers I use preventDefault() and stopPropagation() in the callback function for mouse-wheel event and works perfect because the other browser always trigger a mouse-wheel event but Chrome does not. Reading the question How to catch Zoom event with GWT and Chrome I found that Ctrl + MouseWheel can be caught as a resize event but after zooming the page so I can't prevent the behavior with this one. Is there other event created before Ctrl + MouseWheel in Chrome or is a bug? Rob W

Actions through WebDriver will not trigger the blur event

痴心易碎 提交于 2019-12-05 11:35:19
I have a web page with two dropdowns. Selecting an option in one dropdown will update the list of options in the other dropdown through a script that's triggered by the blur event. The blur event is triggered when the focus moves away from the first dropdown. This all works fine when navigating the page manually. However, when performing the same steps through WebDriver, the blur event is never triggered, and the dropdown is thus never updated, causing my script to fail. Here's the html for the dropdown I select first (and which has the onblur script attached to it: <select id="newOrder

Uncaught (in promise) TypeError: Request failed pwa error

南楼画角 提交于 2019-12-05 10:44:15
问题 I am trying to build a Progressive Web App (PWA). The service worker shows registered, PWA audit shows everything good, but the console shows this error: TypeError: Request failed pwa error I am unable to cache the files. I tried all possible answers on Stack Overflow and it's the same //self.addEventListener('fetch', function(event) {}); var dataCacheName = 'myappData-v3n'; var cacheName = 'myapp-3n'; var filesToCache = [ 'images/logo.png', 'js/jquery.min.js', 'js/popper.min.js', 'js

Dojo: dojo onblur events

我怕爱的太早我们不能终老 提交于 2019-12-05 10:05:41
I have a form setup with dojo 1.5. I am using a dijit.form.ComboBox and a dijit.form.TextBox The Combobox has values like "car","bike","motorcycle" and the textbox is meant to be an adjective to the Combobox. So it doesn't matter what is in the Combobox but if the ComboBox does have a value then something MUST be filled in the TextBox. Optionally, if nothing is in the ComboBox, then nothing can be in the TextBox and that is just fine. In fact if something isn't in the Combobox then nothing MUST be in the text box. In regular coding I would just use an onBlur event on the text box to go to a