delay

Fade out jQuery menu after delay

匆匆过客 提交于 2019-12-21 21:43:04
问题 I'm working on a jQuery drop-down menu that fades in when you hover on the top-level items. I want to set it so that when you move the mouse away the menu doesn't disappear instantly. I have this code: $(document).ready(function(){ $('ul#menu > li').hover( // mouseover function(){ $(this).find('>ul').fadeIn('fast'); }, // mouseout function(){ setTimeout( function(){ alert('fadeout'); $(this).find('>ul').fadeOut('fast') }, 1000 ); } ); }); After a second the alert happens, but the menu isn't

Error with Javascript / Jquery timing in inactive tabs

亡梦爱人 提交于 2019-12-21 13:02:22
问题 I have recently took on the task of building a animation in Javascript / jQuery. The animation consists of a circle moving around the london tube map. Each time it passes a station, the station name is underlined. I am still working on refining it and noticed that when the tab is inactive if messes the timing of the sequence when coming back to the page. Because I am embedding it inside an iframe It does not seem to work when I use $(window).focus() or $(window).blur() . I have animated the

Objective C - Cross-correlation for audio delay estimation

两盒软妹~` 提交于 2019-12-21 11:02:24
问题 I would like to know if anyone knows how to perform a cross-correlation between two audio signals on iOS . I would like to align the FFT windows that I get at the receiver (I am receiving the signal from the mic) with the ones at the transmitter (which is playing the audio track), i.e. make sure that the first sample of each window (besides a "sync" period) at the transmitter will also be the first window at the receiver. I injected in every chunk of the transmitted audio a known waveform (in

$.ready() before closing body

ぃ、小莉子 提交于 2019-12-21 04:02:25
问题 This is not a real coding question, more of a real-world statement. I have previously noted that DOMReady events are slow, very slow. So, I noticed while browsing the jQuery source that the jQuery domeready event can be trigger using $.ready() . Then I thought, placing this simple execution script just before closing the body should trigger all the "onDomReady" listeners that where previoulsy attached. And yes, it works as expected: <script>$.ready()</script> </body> Here are two examples,

JavaScript - How to Wait / SetTimeOut / Sleep / Delay

廉价感情. 提交于 2019-12-21 02:00:25
问题 This again is my Rock Paper Scissors game. At present state the user can't see what's happening because after being prompted for input(Rock, Paper or Scissors) they are immediately reprompted. The question is how can I make the program delay such that they at least can read what's going on. I've read that sleep() does not exist in JavaScript. I'm trying to use setTimeOut however, the setTimeOut is causing the program to not run. Any ideas on how I can delay the next user input after the first

Why can't I delay a remove call with jQuery

孤人 提交于 2019-12-20 17:28:02
问题 I would like for a div to fadeOut and then be removed: $('#div').delay(1000).fadeOut(300); $('#div').delay(1300).remove(); Unfortunately, this just directly removes the div, with no delays. Why is it that I can't get the remove action to be delayed? What solutions are there? Thanks 回答1: If you want the element to be removed after it's done being faded out, you can fadeOut 's callback parameter. $('#div').delay(1000).fadeOut(300, function(){ $(this).remove(); }); 回答2: .delay() only works with

Why can't I delay a remove call with jQuery

不羁的心 提交于 2019-12-20 17:27:03
问题 I would like for a div to fadeOut and then be removed: $('#div').delay(1000).fadeOut(300); $('#div').delay(1300).remove(); Unfortunately, this just directly removes the div, with no delays. Why is it that I can't get the remove action to be delayed? What solutions are there? Thanks 回答1: If you want the element to be removed after it's done being faded out, you can fadeOut 's callback parameter. $('#div').delay(1000).fadeOut(300, function(){ $(this).remove(); }); 回答2: .delay() only works with

AudioTrack lag: obtainBuffer timed out

一世执手 提交于 2019-12-20 12:35:35
问题 I'm playing WAVs on my Android phone by loading the file and feeding the bytes into AudioTrack.write() via the FileInputStream > BufferedInputStream > DataInputStream method. The audio plays fine and when it is, I can easily adjust sample rate, volume, etc on the fly with nice performance. However, it's taking about two full seconds for a track to start playing. I know AudioTrack has an inescapable delay, but this is ridiculous. Every time I play a track, I get this: 03-13 14:55:57.100: WARN

fade out div after x seconds with jquery

空扰寡人 提交于 2019-12-20 11:28:08
问题 I do a fade in div that is not displayed when I load the page: $('#overlay').fadeIn('fast'); $('#box').fadeIn('slow'); I would do this instructions after x seconds, doing a fadeOut of the div: $('#overlay').fadeOut('fast'); $('#box').hide(); How can I do it? Actually fadeOut is done on button click. The script is here: http://clouderize.it/cookie-localstorage/a.php The div that appear when I click on another image will disappear after x seconds. Thanks a lot. 回答1: The .delay method is purpose

jquery each add class with delay inbetween

五迷三道 提交于 2019-12-20 10:44:33
问题 I need to loop through each div .row to add or remove a flip class that has a CSS3 3D transform effect. When I apply this add/remove class to each ".row" with jquery each(), all the divs get the class ".flip" added or removed at the exact same time. I need this to be delayed so it looks like a domino effect. Any idea how I can get this working? Or how to add / remove the flip class one by one?? This is what I've found but it is not working: $('.row').each(function(i){ if($(this).hasClass(