dom-events

Prevent click event from propagating/bubbling onto Google Maps

流过昼夜 提交于 2019-12-23 04:14:27
问题 I am using the MarkerClusterer library for Google Maps API V3 to group nearby markers into a single marker. When the user clicks on the cluster marker, a div appears beside that cluster marker. Now I want to make it such that after clicking on the cluster marker, to close the div that popped up, he can click on the map. Problem: After adding a google.maps.event.addListener(map, 'click', function(){}) on the map, when the user clicks on the cluster marker to open the popup div, nothing happens

Google Maps v3 InfoBox Event Propagation in Mobile Safari

China☆狼群 提交于 2019-12-23 03:47:20
问题 I have created an infobox using google maps api v3 and infoBox from the maps utility library . The infobox has overflow-y data. Scrolling works exactly as expected on IE, FF, Chrome and Safari desktop. Scrolling does not work at all, however, in mobile Safari. It's almost as if the infoBox doesn't detect a touch to start scrolling. I've created this jsfiddle to demonstrate the problem. As you can see (in the iOS simulator or on an iOS device), the mouseenter, touchstart, mouseleave and

Closure issue with Listener and Google Maps markers

空扰寡人 提交于 2019-12-22 10:46:36
问题 I want to add a Listener event to each generated marker, so that when you click a marker you are redirected to the permalink url. With the code below the permalink value is the same for every marker(it get's the last value). I've read about closure problems and that seems to be what I'm having. I don't really get the examples I've looked at though. Can somebody take a look at my code and point me in the right direction? Any help is greatly appreciated! downloadUrl("http://localhost/map

plupload smartphone and tablet browse button event not firing

妖精的绣舞 提交于 2019-12-22 10:22:13
问题 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',

Event before 'load event' for Firefox extension?

别来无恙 提交于 2019-12-22 09:55:31
问题 I'm writing a Firefox extension, This is my XUL (no problem there) <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE overlay SYSTEM "chrome://locale/myDtd.dtd"> <page id="overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <script type="application/x-javascript" src="chrome://addon/content/test.js" /> </page> And here is the problematic part of the Javascript test.js window.addEventListener("load", function(event) {

Pressing 2 keys, release 1, produces keydown of other key again

陌路散爱 提交于 2019-12-22 05:43:13
问题 I press S, followed by D, on my keyboard, and release S. Why does the following code trigger a key down event for D once again, after I release S? Is there some way to find out that the second down event for D was caused by a key up of another key? function handler(event) { if (!event.repeat) console.log(event.code, event.type); } window.addEventListener('keydown', handler); window.addEventListener('keyup', handler); Output: KeyS keydown - S pressed KeyD keydown - D pressed KeyS keyup - S

How to easily listen for xhr requests with Javascript?

余生长醉 提交于 2019-12-22 05:33:28
问题 I am working on a Firefox extension and I want to know when a page initiates a xhr request, I saw a few codes but they were pretty big, is there any simple sample to achieve this? I am testing this code : function TracingListener() { //this.receivedData = []; } TracingListener.prototype = { originalListener: null, receivedData: null, // array for incoming data. onDataAvailable: function(request, context, inputStream, offset, count) { var binaryInputStream = CCIN("@mozilla.org

Tooltips (title=“…”) won't show in Firefox

旧时模样 提交于 2019-12-22 04:46:21
问题 I have an element with a title attribute (i.e., a tooltip), wrapped in some container: <div id="foo"> <input type="text" title="A tooltip" /> </div> and I attach a "mousemove" event listener on the container and stop event propagation: document.getElementById('foo').addEventListener( 'mousemove', function(e) { e.stopPropagation() }, false ) This combination of stopping propagation of "mousemoves" on the container now prevents the tooltip from showing up for the inner textbox, in Firefox 2 and

Feature-detect: mutation-event availability in JavaScript?

冷暖自知 提交于 2019-12-22 04:36:21
问题 How can my JavaScript detect if an event is available? I'm aware of some great event-compatibility tables, but I need to use feature detection, not browser-sniffing plus a lookup table. Specifically, my JS makes great use of the DOM mutation events ( DOMNodeInserted and DOMSubtreeModified ) -- which work great in all browsers except (of course) Internet Explorer. So, how would I detect if a browser supports DOMNodeInserted ? 回答1: If you just want to check if the browser supports mutation

iOS Disable Page Scrolling with overflow-scrolling: touch

本秂侑毒 提交于 2019-12-22 04:03:08
问题 Let's say we want to make a webapp feel like a native app with "Add to Home Screen." One of the first steps is to disable the default scrolling. Easy, right? // window or document window.addEventListener("touchmove", function(event) { // no more scrolling event.preventDefault(); }, false); That's all fine and dandy until you add overflow-scrolling to the mix. To be precise, on iOS it would be -webkit-overflow-scrolling: touch . /* #scrollable happens to be a ul */ #scrollable { overflow-y: