dom-events

Firefox addon to do something everytime a user hits Enter in the address bar

萝らか妹 提交于 2019-12-24 01:36:04
问题 I'm trying to write an extension that monitors every time someone types hits enter when using the address bar. The steps would be something along the lines of User types in a bunch of text in the address bar and hits Enter My addon springs to life and receives what the user typed in My addon then decides what to do with the string the user typed in. I get the url in step 2 by using var url = window.location.href . I also have most of step 3 written out already. The only probably I can't seem

Mouseover event triggered by Child Elements - how to stop this?

梦想的初衷 提交于 2019-12-24 00:45:31
问题 I have this interface I want to build using Effect.Move from scriptaculous (with Prototype, of course). When the top div is triggered on a mouseover, a span tag is to move 50 pixels to the left - and reset without movement to the original location on mouseout. The problem is, any time this div element is entered from a child element, the element I want moved moves an additional 50 pixels. I've tried using relatedTarget and toElement to stop this event from propogating, but to no avail. Here

How to use EventManager to listen to window.resize events in angular?

最后都变了- 提交于 2019-12-23 12:04:13
问题 I'm borrowing some code from this stackoverflow: Angular window resize event The author of the answer says I should be using the EventManager if I want to listen for window events from a service and not break Angular Universal. That being said, is this answer still true? If so, could someone show me why when I subscribe to the onResize$ Observable logs nothing when the window is resized? import { EventManager } from '@angular/platform-browser'; import { Observable } from 'rxjs/Observable';

How/when do event listeners get attached in d3.js?

半腔热情 提交于 2019-12-23 11:57:49
问题 I am trying to make an SVG editor of sorts. Long story short, I need to attach mouse events to <g> elements at a specific depth within a given SVG. For various reasons I cannot know the ID ahead of time. The SVG is huge and will have hundreds if not thousands of elements. d3.selectAll("svg > g > g > g").select("g").on("mouseover", function() { console.log("mouseover"); }).on("mouseout", function() { console.log("mouseout"); }).on("click", function() { console.log("clicked"); }); This code

Detecting scroll finish/end

核能气质少年 提交于 2019-12-23 10:15:54
问题 I'd like to detect when a user has stopped scrolling a page/element. This may be tricky as recently enhancements to OSX's scrolling behaviour creates this new inertia effect. Is there an event fired? The only other solution I can think of is using a interval to pick up when the scroll position of a page/element no longer changes, for example: var element = $( el ); var previous = element.scrollLeft(); var current; element.scroll( function(event) { current = element.scrollLeft(); if ( current

Touchend not firing after touchmove on Android 4.x?

纵然是瞬间 提交于 2019-12-23 08:57:11
问题 I am writing some code with Javascript just like this: var el = document.getElementById('some-div'); el.ontouchstart = function(e){ el.innerHTML = "touch start"; }; el.ontouchend = function(e){ el.innerHTML = "touch end"; }; el.ontouchmove = function(e){ el.innerHTML = "touch moved"; }; This code work fine on iOS/Safari and Android 2.x.x . On Android 4.x (I tried 4.0.4 & 4.1) , touchend not firing after touchmove. If I tap the screen, don't move my finger, touchend will be fired. How to fix

How to create hyper link in ExtJS 4?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 07:25:37
问题 I am working in ExtJS 4.I have been getting stuck at a point where I have to create a hyperlink in ExtJS 4.I have been searching a lot for creating hyperlink in ExtJS 4 but I did not get any solution for it.Actually I have to create a hyperlink and after clicking on that link I am going to display another page in ExtJS 4. Actually also i did not get the event in ExtJS 4. How can I use hyperlink in ExtJS 4. I am using this way... { xtype: 'panel', html:'<a href="second.js">Second page</a>', }

How to create hyper link in ExtJS 4?

风格不统一 提交于 2019-12-23 07:25:24
问题 I am working in ExtJS 4.I have been getting stuck at a point where I have to create a hyperlink in ExtJS 4.I have been searching a lot for creating hyperlink in ExtJS 4 but I did not get any solution for it.Actually I have to create a hyperlink and after clicking on that link I am going to display another page in ExtJS 4. Actually also i did not get the event in ExtJS 4. How can I use hyperlink in ExtJS 4. I am using this way... { xtype: 'panel', html:'<a href="second.js">Second page</a>', }

Javascript/HTML5 - Making a canvas animation using WASD to move around a rectangle. Trouble implementing A and W keys

心已入冬 提交于 2019-12-23 04:26:50
问题 I'm making a simple canvas where the user uses WASD to move a rectangle up, left, down, right, respectively. The animation works fine for S and D keys, but when I tried to do the a key it doesn't work, and I'm not sure why. Below is my code. //event listener window.addEventListener("keydown", onKeyDown, false); window.addEventListener("keyup", onKeyUp, false); function onKeyDown(event){ var keyCode = event.keyCode; switch(keyCode){ case 68: //d keyD = true; break; case 83: //s keyS = true;