>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

Canceling and Stopping Browser Events - elements link event background prevent events click div

 
Registered tutorials: 501
Registered Users: 33128



Rating: 0 out of 0 votes cast


  
Category: Technique Introduction

Canceling and Stopping Browser Events

Digg this   Post to del.icio.us

Abstract: This article shows how to cancel or disable the default browser event to avoid undesired behaviour and get only what you need

If your Ajax application is graphically intensive, it probably uses a lot of CSS absolute positioned elements and the CSS z-order attribute extensively. The problem with overlapping elements is that events automatically bubble up from foreground elements to background elements, so if you blindly capture events like click in background elements, you may receive them when you are not expecting them. For example, if you have a div element floating above other elements, events will automatically bubble up to background elements, often leading to your application inadvertently handling the event in both the foreground div and the background div.

If you want to prevent events from bubbling up to background elements, you can capture the event with this recipe:

function stopEvent(e) {     if (!e) e = window.event;     if (e.stopPropagation) {         e.stopPropagation();     } else {         e.cancelBubble = true;     } }

Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 18
Unique Hits: 17


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 0 0 0.1 0.1 0.4 0.4
Current 0 0 0 0 0 0
Previous 0 0 0 0 1 1
Nov 29 0 0 0 0 1 1
Nov 28 0 0 0 0 1 1
Nov 27 0 0 0 0 0 0
Nov 26 0 0 0 0 0 0
Nov 25 0 0 1 1 0 0
Nov 24 0 0 0 0 0 0
Nov 23 0 0 0 0 1 1
Nov 22 0 0 0 0 0 0
Highest 1 2 1 2 2 2


Script Execution Time: 2.70292 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2