Disable callout (context menu) on mobile IE

In a web app, I need to disable the default callout that mobile browsers shows when touching and holding ("long tap") on a touch target, such as an <img> or a link. I am already using -webkit-touch-callout: none for iPhone and iPad. I tried -ms-touch-action:none and touch-action:none for IE, but this doesn't seem to work (tested on IE11, Windows Phone 8). This post from t

在移动IE上禁用标注(上下文菜单)

在网络应用程序中,我需要禁用移动浏览器在触摸目标(例如<img>或链接)上触摸并保持(“长按”)时显示的默认标注。 我已经在iPhone和iPad上使用-webkit-touch-callout: none 。 我试过-ms-touch-action:none和touch-action:none用于IE,但这似乎不起作用(在IE11,Windows Phone 8上测试过)。 W3邮件列表中的这篇文章建议为Javascript中的“contextmenu”事件添加一个监听器,并调用e.preventDefault() 。 这似乎也不

How to do chained transitions on different elements in d3.js?

I would like to do chained transition on different elements. Throughout the program I want to run a sequence of transitions. After the first transition on element x finishes I want to start with transitioning on element y, and so forth. The transitions should vary in duration. One way to "solve" it is delaying all the latter transitions based on the sum of durations of previous tra

如何在d3.js中的不同元素上进行链式转换?

我想对不同的元素进行链式转换。 在整个计划中,我想运行一系列转换。 在元素x上的第一次转换完成后,我想从元素y上的转换开始,等等。 过渡期应有所不同。 “解决”它的一种方法是基于先前转换的持续时间总和来延迟所有后面的转换。 但这很丑陋,因为它非常混乱而且不准确。 这是我尝试完成的一个例子: <!DOCTYPE html> <meta charset="utf-8"> <head> <script src="https://d3js.org/d3.v

JavaScript delay navigation until callback/timeout

TLDR: you can't, see bottom of question for alternative solution (ie the one I compromised with). I have an async function that sends data to a server on a link click, of course this will most likely not get sent because of the page unload timing. Is there any way that I can either delay the effect of the click until either the callback function runs or a timeout occurs (both would be in

JavaScript延迟导航,直到回调/超时

TLDR:你不能,看到替代解决方案的底部问题(即我所妥协的解决方案)。 我有一个异步功能,通过链接点击将数据发送到服务器,当然由于页面卸载时间的原因,这很可能不会发送。 有没有什么办法可以延迟点击的效果,直到回调函数运行或发生超时(两者都会生效,超时会限制可能的延迟)。 点击=>等待超时/回调=>继续正常事件。 要么 点击=>开始呼叫和超时,取消默认功能回调/超时呼叫功能继续/重新启动点击过程

What is event bubbling and capturing?

What is the difference between event bubbling and capturing? Of the two, which is the faster and better model to use? Event bubbling and capturing are two ways of event propagation in the HTML DOM API, when an event occurs in an element inside another element, and both elements have registered a handle for that event. The event propagation mode determines in which order the elements receive t

什么是事件冒泡和捕获?

事件冒泡和捕获有什么区别? 在这两种模式中,哪种模式更快更好? 事件冒泡和捕获是HTML DOM API中事件传播的两种方式,其中一个事件发生在另一个元素内的元素中,并且这两个元素都为该事件注册了一个句柄。 事件传播模式确定元素以什么顺序接收事件。 冒泡时,事件首先被最内层的元素捕获并处理,然后传播到外层元素。 捕获时,事件首先被最外层的元素捕获并传播到内层元素。 捕捉也被称为“滴答”,这有助于记住传播顺

Wait till a Function with animations is finished until running another Function

I'm having an issue with normal ( non-ajax ) functions that involve lots of animations within each of them. Currently I simply have a setTimeout between functions, but this isn't perfect since no browsers / computers are the same. Additional Note: They both have separate animations/etc that collide. I can't simply put one in the callback function of another // multiple dom anima

等到带有动画的功能结束后再运行另一个功能

我遇到了一个正常( 非Ajax )函数的问题,这些函数在每个函数中涉及大量动画 。 目前我只是在函数之间有一个setTimeout ,但这并不完美,因为没有浏览器/计算机是相同的。 附加说明:它们都有独立的动画/等相互冲突。 我不能简单地把一个放在另一个的回调函数中 // multiple dom animations / etc FunctionOne(); // What I -was- doing to wait till running the next function filled // with animations, etc setTime

Check if any element with a certain class is empty

My page contains multiple elements like this: <span class="field-validation-valid text-danger" data-valmsg-for="CcInfo.CcCheck" data-valmsg-replace="true"></span> <span class="field-validation-valid text-danger" data-valmsg-for="CcInfo.CcCheck" data-valmsg-replace="true">Something went wrong</span> <span class="field-validation-valid text-danger" data-valmsg-for="CcInf

检查任何具有某个类的元素是否为空

我的页面包含这样的多个元素: <span class="field-validation-valid text-danger" data-valmsg-for="CcInfo.CcCheck" data-valmsg-replace="true"></span> <span class="field-validation-valid text-danger" data-valmsg-for="CcInfo.CcCheck" data-valmsg-replace="true">Something went wrong</span> <span class="field-validation-valid text-danger" data-valmsg-for="CcInfo.CcCheck" data-v

Jquery append div to new div

I have to append 2 div to new div: <script type="text/javascript"> $(function() { $( "#table-filter_wrapper" ).append($( "<div class='main_tbl_btm_info'></div>" )); $( "#table-filter_info" ).appendTo( $( ".main_tbl_btm_info" )); $( "#table-filter_paginate" ).appendTo( $( ".main_tbl_btm_info" )); }); </script> The proble

jquery将div添加到新div

我必须追加2 div到新的div: <script type="text/javascript"> $(function() { $( "#table-filter_wrapper" ).append($( "<div class='main_tbl_btm_info'></div>" )); $( "#table-filter_info" ).appendTo( $( ".main_tbl_btm_info" )); $( "#table-filter_paginate" ).appendTo( $( ".main_tbl_btm_info" )); }); </script> 问题在于它无法在

If DIV is present on page then add CSS to other DIV

I'm very new to jQuery BUT I've got the basics down... At least I think I do? I'm just not sure how to put them together for them to actually work. Example: IF (div with ID of #dynamicChat) is present on the page. Then (div with class of .prdSection) height is 25px. Else do nothing What I have so far: $('#dynamicChat'){ $('.prdSection').css('height', '25px'); } I don't

如果页面上存在DIV,则将CSS添加到其他DIV

我对jQuery非常陌生,但我已经掌握了基础知识......至少我认为我是这样做的? 我只是不确定如何把它们放在一起让他们实际工作。 例: IF(ID为#dynamicChat的div)出现在页面上。 然后(div类与.prdSection)高度是25px。 否则什么也不做 我到目前为止: $('#dynamicChat'){ $('.prdSection').css('height', '25px'); } 我不认为我很遥远......说我可能是:)任何帮助将是伟大的! *侧面问题 - 如果我指的是页面上的D

Check block existence by jQuery

How do I know if there is a block with class "media" on the page? if(<div class="media"></div> exist in current page){ //then do something } This code doesn't work: if($(".media")){ //do } You need to check if ($('.media').length) . $(...) returns a jQuery object, which will always be "truthy", even when empty. However, if it's empty, its le

通过jQuery检查块的存在

如何知道页面上是否有“媒体”类? if(<div class="media"></div> exist in current page){ //then do something } 此代码不起作用: if($(".media")){ //do } 你需要检查if ($('.media').length) 。 $(...)返回一个jQuery对象,即使在空的情况下,该对象也总是“真实”。 但是,如果它是空的,则其length属性将为0 ,这是“虚假”。 if ($('.media').length > 0)你也可以更明确地写出来。 i

Checking if a button exists

I have a .js file that is invoked by a few .jsp pages. What I need to do in this particular .js file is to invoke a certain function only if the 'save' button is present in the .jsp page. How do I check if the the button exists? Currently in the .js file the button is refered to this way: $('button[id=save]') How do I check if such a button exists? Hope someone can advise.

检查是否存在按钮

我有一个.js文件,由几个.jsp页面调用。 我在这个特定的.js文件中需要做的是仅当.jsp页面中存在'save'按钮时才调用某个函数。 如何检查按钮是否存在? 目前在.js文件中,按钮指的是这种方式:$('button [id = save]') 我如何检查这个按钮是否存在? 希望有人能提供建议。 谢谢。 尝试这样的事情 $(document).ready(function(){ //javascript if(document.getElementById('save')){