mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-20 16:00:31 +00:00
57 lines
No EOL
2.2 KiB
HTML
57 lines
No EOL
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang='en'><head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1"><meta http-equiv='content-type' content='text/html; charset=UTF-8' /></head><body>
|
|
<div data-role="page">
|
|
<div data-role="header">
|
|
<h1>event.stopImmediatePropagation()</h1>
|
|
|
|
</div>
|
|
<div data-role="content" data-theme="c" id="event.stopImmediatePropagation1">
|
|
<h2 class="jq-clearfix roundTop section-title">
|
|
<span class="name">event.stopImmediatePropagation()</span> <span class="returns"></span>
|
|
</h2>
|
|
<div class=" entry-details">
|
|
<p class="desc"><strong>Description: </strong> Keeps the rest of the handlers from being executed.
|
|
</p>
|
|
<ul class="signatures"><li class="signature" id="event.stopImmediatePropagation"><h4 class="name">
|
|
<span class="versionAdded">version added: <a href="/category/version/1.3/">1.3</a></span>event.stopImmediatePropagation()</h4></li></ul>
|
|
<div class="longdesc"><p>This method also stops the bubbling by implicitly calling <code>event.stopPropagation()</code>. Use <code>event.isImmediatePropagationStopped()</code> to know whether this method was ever called (on that event object).</p></div>
|
|
<h3>Example:</h3>
|
|
<div id="entry-examples" class="entry-examples"><div id="example-0">
|
|
<h4><span class="desc">Prevents other event handlers from being called.</span></h4>
|
|
<pre><code class="example demo-code"><!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
p { height: 30px; width: 150px; background-color: #ccf; }
|
|
div {height: 30px; width: 150px; background-color: #cfc; }
|
|
</style>
|
|
<script src="http://code.jquery.com/jquery-latest.js"></script>
|
|
</head>
|
|
<body>
|
|
<p>paragraph</p>
|
|
<div>division</div>
|
|
<script>
|
|
$("p").click(function(event){
|
|
event.stopImmediatePropagation();
|
|
});
|
|
$("p").click(function(event){
|
|
// This function won't be executed
|
|
$(this).css("background-color", "#f00");
|
|
});
|
|
$("div").click(function(event) {
|
|
// This function will be executed
|
|
$(this).css("background-color", "#f00");
|
|
});</script>
|
|
</body>
|
|
</html></code></pre>
|
|
<h4>Demo:</h4>
|
|
<div class="demo code-demo"></div>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body></html> |