The Ashes

Technology, Science and other news
August 22, 2009

Crazy sexy Firefox multitouch demo

Posted by : admin
Filed under : General

Felipe Gomes has extended multitouch support in Firefox to reach into content space (i.e. us Web devs can use it!). Checking out the sexy demos in the video above will make you pine for the day (not long!) where all laptop screens support touch (my son thinks they are already 😉

We have three new DOM events (MozTouchDown, MozTouchMove and MozTouchRelease), which are similar to mouse events, except that they have a new attribute called streamId that can uniquely identify the same finger being tracked in a series of MozTouch events. The following snippet is the code for the first demo where we move independent <div>s under the X/Y position of each touch point.


  2. var assignedFingers = {};
  3. var lastused = 0;
  5. function touchMove(event) {
  6.   var divId;
  7.   if (lastused <= 4) return;
  8.   if (assignedFingers[event.streamId]) {
  9.     divId = assignedFingers[event.streamId];
  10.   } else {
  11.     divId = “trackingdiv” + (++lastused);
  12.     assignedFingers[event.streamId] = divId;
  13.   }
  14.   document.getElementById(divId).style.left = event.clientX + ‘px’;
  15.   document.getElementById(divId)  = event.clientY + ‘px’;
  16. }
  18. document.addEventListener(“MozTouchMove”, touchMove, false);
  19. document.addEventListener(“MozTouchRelease”, function() { lastused–; }, false);

You can check out code from all of the demos.

We’ll also add CSS support to detect touchscreen devices. Using the pseudo-selector :-moz-system-metric(touch-enabled), you can apply specific styles for your page only if it’s viewed by a touchscreen user. That, along with physical CSS units (cm or in), makes it possible to adjust your webapp for a touchscreen experience.

Filipe is one of the amazing interns that has worked at Mozilla this summer. Summer at Moz is a fantastic experience with them around. It is a shame to see them go, but I can’t wait to see what Filipe and the others get up to next!

Tags :

No Comments

(will not be published) (required)
(opitional) EN ES IT DE PT CZ FR RU
October 2021




There are many online poker site where you can play but at you can play the poker games with all the knowledge you need related to the game with the poker school available in both the English and Chinese language.

Super Casino

Now you can bet on any sports and any sporting events from all the comfort from your home. Bet770 allows you to bet on any events and match with in just 3 clicks. They also offers great odds on football betting for every premier and champions league match. Get £50 free in bets when you register.

Bingo770, offering best online bingo games with £7.70 free no deposit Bonus!