stoppropagation

selective stoppropagation jquery

岁酱吖の 提交于 2021-02-10 07:14:42
问题 Javascript code: $(".div1").click(function(event){ event.stopPropagation(); $(".div1 div").slideToggle(); }); $(".div2").click(function(event){ event.stopPropagation (); $(".div2 div").slideToggle(); }); $(document).click(function(event){ $(".div1 div,.div2 div").slideUp(); }); Suppose I click .div1 & .div1 div slides down. Then i click .div2 But as event.stopPropagation is executed, .div1 div doesnot slide up. So what should i do? I dont want to put this code $(".div1 div").slideUp(); as it

Is it possible to stop propagation by CSS?

情到浓时终转凉″ 提交于 2021-02-10 06:46:06
问题 With Javascript it is possible to stop propagation with code? E.g. function func1(event) { alert("DIV 1"); if (document.getElementById("check").checked) { event.stopPropagation(); } } Is it also possible to stop propagation by CSS? 回答1: Sort-of, in some browsers. You can use the 'all' property to reset an element back to initial values. That should mean the initial values inherit down from there. Unfortunately it's not supported by IE and Edge though. https://www.caniuse.com/#search=all 来源:

Stop propagation of a specific event inside another event listener

会有一股神秘感。 提交于 2021-01-29 11:15:45
问题 I have a listener attached to resize event on window object. Deeper in my code, I have some input fields. To avoid some issues on android devices, I’d like to prevent resize listeners from being fired when an input field is focused (android device resize browser window when opening keyboard, unlike IOS). main.js window.addEventListener(‘resize’, () => { // Some stuff here }); someFile.js field.addEventListener(‘input’, () => { // Here I want to disable the resize event only once }); I came

Vue.js - Stop propagation for multiple event handlers

家住魔仙堡 提交于 2020-06-27 04:08:21
问题 I have a component that emits an showSelection event on click but also retains the click event handler given to it by its parent. <template> <section class="base-input peudo-select"> <input v-bind="$attrs" type="text" readonly v-on="listeners" @dblclick.prevent.stop /> </section> </template> <script> export default { ... computed:{ listeners(){ return { ...this.$listeners, input: event => this.$emit('input', event.target.value), click: [ this.$listeners.click, // Always put the parent given

Add key eventlistener to last generated input field and stop it after typing

你离开我真会死。 提交于 2020-01-06 10:07:04
问题 When I click a Button, a form of an unspecific number of input fields will be generated in my dom plus an empty input Field. I want to add something like a keypress event to the last generated empty input field. When I start typing, into the last empty input field, another input field should append. This new appended input field should get the keypress eventlistener and the input field I am in should loose the keypress eventlistener. Here's how I did it( EDIT: added as code snippet): $

Add key eventlistener to last generated input field and stop it after typing

∥☆過路亽.° 提交于 2020-01-06 10:07:02
问题 When I click a Button, a form of an unspecific number of input fields will be generated in my dom plus an empty input Field. I want to add something like a keypress event to the last generated empty input field. When I start typing, into the last empty input field, another input field should append. This new appended input field should get the keypress eventlistener and the input field I am in should loose the keypress eventlistener. Here's how I did it( EDIT: added as code snippet): $

Add key eventlistener to last generated input field and stop it after typing

你说的曾经没有我的故事 提交于 2020-01-06 10:06:51
问题 When I click a Button, a form of an unspecific number of input fields will be generated in my dom plus an empty input Field. I want to add something like a keypress event to the last generated empty input field. When I start typing, into the last empty input field, another input field should append. This new appended input field should get the keypress eventlistener and the input field I am in should loose the keypress eventlistener. Here's how I did it( EDIT: added as code snippet): $

event.stopPropagation() not working in chrome with jQuery 1.7

a 夏天 提交于 2020-01-03 17:22:48
问题 For some reason clicking the document isn't working in Chrome (the closeQuickView is not being called). The elements are loaded via AJAX and so need to have .on() action (previously .live() which is now deprecated in jQuery 1.7) Used the example given here: How do I detect a click outside an element? as a basis $('html').on('click', '.poster:not(.active) .image-effect', function (event) { var obj = $(this).parent(); // If there are no .close spans if (obj.find('.close').length === 0) { // Add

jQuery stopPropagation not working

我只是一个虾纸丫 提交于 2020-01-03 16:40:29
问题 I'm using the following color picker and it works fine, but when i click on the color picker icon, i don't want it to bubble to body. So i tried the following and now the color picker is not working. Check http://jsfiddle.net/CWGgM/ . If you remove the below code from jsfiddle then it works. What is causing this $('#test').click(function(e){ e.stopPropagation(); }); 回答1: It appears to use its own live() style code, where events are allowed to bubble up and are handled on the document .

After first click, If ajax is done, on second click e.stopPropagation

穿精又带淫゛_ 提交于 2019-12-25 16:51:50
问题 When some div is clicked, a div is appended and ajax loads some data inside the newly created div, problem is that when a second click occurs on the div that causes the append, another div is created which is the duplicate of the previous div which still exists and visible creating clutter and disorder. How do i stop a second click or destroy the first created div when the second one is created? Javascript. $(document).on('click', '.LibSectOpen', function() { var LibSect = ($(this).find('