delay

RecyclerView : How to create insert animation effect?

徘徊边缘 提交于 2019-11-30 07:24:09
I have a ReyclerView working with a LinearLayoutManager and an Adapter<ViewHolder> . I have a list of items I would like to display in the recyclerview with the insert (slide in) animation. How do I go about this ? I would like to display the animations with a linearly increasing delay based on the index of the item. Currently, if I use 2 buttons, 'add' and 'remove', and then do the respective operations on the recyclerview ( notifyItemInserted() and notifyItemRemoved() , the animations come in nicely. If I programmatically loop on the data set and add the items, again, using

How to use FastClick.js with Phonegap and JQM?

泪湿孤枕 提交于 2019-11-30 06:51:36
I've tried a few different ways to remove the 300ms delay due to the webkit browsers handling of touch events. The library, FastClick.js, seems to be the preferred method, yet I'm having a little trouble implementing it. I've included it and also added an event listener, but I don't know if I've added the listener correctly. Should this be working or am I failing to do something? Thank you! Consider the code below, where <!DOCTYPE html> <html> <head> <title> Calculator </title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0, user-scalable=no;"> <meta

Can I use .delay() together with .animate() in jQuery?

强颜欢笑 提交于 2019-11-30 06:39:50
I have this code, which slides open a basket preview on a website I am working on. It stays open if the user is hovered on it, but I want it to have a two second delay before the callback for my hover is triggered. This is just in case the user didn't want the mouse to leave the basket area. Below is the code I am using to animate the basket: $('.cart_button, .cart_module').hover(function(){ $(".cart_module").stop().animate({top:'39px'},{duration:500}); }, function(){ $('.cart_module').stop().animate({top: -cartHeight},{duration:500}) }); Here is the code I tried to use, but had no affect: $('

Adding a delay without Thread.sleep and a while loop doing nothing

荒凉一梦 提交于 2019-11-30 05:08:57
问题 I need to add delay without using Thread.sleep() or a while loop doing nothing. The game im editing(Minecraft) clock runs on "Ticks" but they can fluctuate depending on your FPS. public void onTick() {//Called every "Tick" if(variable){ //If my variable is true boolean = true; //Setting my boolean to true /** *Doing a bunch of things. **/ //I need a delay for about one second here. boolean = false; //Setting my boolean to false; } } The reason why i need a delay is because if i dont have one

How Can I Open a WPF Popup with a Delay?

試著忘記壹切 提交于 2019-11-30 04:59:30
I simply want to open up the WPF Popup with a delay, sort of like a ToolTip . How can I achieve this? And, by the way, Popup.PopupAnimation = PopupAnimation.Fade ... fades in too quickly. I want at least half a second in there. You can create a style to be applied to the Popup in the following way: <Style x:Key="TooltipPopupStyle" TargetType="Popup"> <Style.Triggers> <DataTrigger Binding="{Binding PlacementTarget.IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard x:Name="OpenPopupStoryBoard" > <Storyboard>

Jquery delay() function

大城市里の小女人 提交于 2019-11-30 04:48:16
I have some jquery and am trying to apply a delay to it but can't seem to get it to work. The current jquery is as follows... image.css({"visibility" : "hidden"}).removeClass("image-background"); and I have tried ammending this according to the jquery website (http://api.jquery.com/delay/) to apply the delay... image.delay(800).css({"visibility" : "hidden"}).removeClass("image-background"); but this doesn't seem to make any difference. Can anyone see a problem with this? Or how I could fix the problem? Thanks in advance. The delay() function only applies to actions queued on the element. Most

How to make delay between each loops of jQuery.each function?

删除回忆录丶 提交于 2019-11-30 04:13:22
I have this-like code: $('li').each(function(){ var data = $(this).text(); requestFunction(data, function(status){ if ( status == 'OK' ) do stuff... }); }); So, i need to do some delay between using function "requestFunction()". How could i do this? Hope it understandable, thanks. setTimeout at an increase time: $('li').each(function(indexInArray){ var data = $(this).text(); setTimeout( function () { requestFunction(data, function(status){ if ( status == 'OK' ) do stuff... }); }, indexInArray * 500); }); if you loop over these elements, we want to increase the timeout or else all the request

Delay automatic url redirect with jquery?

让人想犯罪 __ 提交于 2019-11-30 02:48:59
I need a transition page that will display for 2 seconds before automatically redirecting to the home page. How do I do this? I can't seem to get delay to work for me. You can just use setTimeout() directly, like this: setTimeout(function() { window.location.href = "/NewPage.aspx"; }, 2000); setTimeout(function(){ window.location = "/NewPage.aspx"; }, 2000); You could use jQuery Timer . Here is the code (also found in this article ): // This will hold our timer var myTimer = {}; // delay 2 seconds myTimer = $.timer(2000, function() { //redirect to home page window.location = "/RedirectTimer

How to create delay function in QML?

你说的曾经没有我的故事 提交于 2019-11-29 22:23:34
I would like to create a delay function in javascript that takes a parameter of amount of time to delay, so that I could use it do introduce delay between execution of javascript lines in my QML application. It would perhaps look like this: function delay(delayTime) { // code to create delay } I need the body of the function delay() . Note that setTimeout() of javascript doesn't work in QML. Marcus Ottosson As suggested in the comments to your question, the Timer component is a good solution to this. function Timer() { return Qt.createQmlObject("import QtQuick 2.0; Timer {}", root); } timer =

Ways to throttle ajax requests

早过忘川 提交于 2019-11-29 19:47:15
问题 I'm using the following code (written by another user) to throttle ajax requests in a livesearch function: JSFiddle if you prefer a demo: http://jsfiddle.net/4xLVp/ It seems buggy, though. Clearing values with Ctrl+shift+back-arrow , and typing again causes a flurry of requests. Blank values also cause a request. It dones't seem right, especially compared to jQuery UI autocomplete, where request delays seem more measured. $('##tag-search').keyup(function() { var elem = $(this); if (elem.val()