jQuery一次淡入/淡出两个div,循环并重复(jQuery fade in/out two divs at a time, looping and repeating)
我正在使用Wordpress的高级自定义字段插件,并激活了Repeater字段 ,以便客户端能够添加任意数量的推荐。 推荐书分别显示在前端的
.quote
div中。 但是,我只希望一次显示两个.quote
div(按连续顺序),并且在时间上淡入/淡出两个。喜欢这个:
页面加载 :显示引号1和2。 7秒过去 :显示报价3和4。 再过7秒 :显示报价5和6。 重复等,不依赖于引用量(可能有
.quote
等),一旦达到最后两个.quote
div,它将.quote
重新开始。我把一些超级简陋的代码拼凑在一起试图说明我的观点: http : //jsfiddle.net/9kg6L/
我确信这有一个简单的解决方案,但我仍然是一个写jQuery的新手,所以我希望从这个小经验中学习:)
I'm using the Advanced Custom Fields plugin for Wordpress with the Repeater Field activated to give a client the ability to add as many testimonials as they want. The testimonials are each displayed inside a
.quote
div on the front-end. However, I only want two.quote
divs to be displayed at a time (in consecutive order), and fade in/out two at at time.Like this:
Page loads: quotes 1 & 2 are shown. 7 seconds go by: quotes 3 & 4 are shown. Another 7 seconds go by: quotes 5 & 6 are shown. Repeat, etc, not dependent on the amount of quotes there are (there could be 20, 5, 18, etc.) and once the last two
.quote
divs are reached, it will restart from the beginning.I've thrown together a super rudimentary and terrible bit of code to try and illustrate my point here: http://jsfiddle.net/9kg6L/
I'm sure there's an easy solution for this, but I'm still a newbie writing jQuery, so I hope to learn from this little experience :)
原文:https://stackoverflow.com/questions/15913231
最满意答案
对于你的第一个问题:对我来说,一个算法可以是一个想法,如“计算你需要的数组的所有元素的总和......”,一个函数(有一个输入和un输出和一些步骤介于两者之间)或一系列数学运算。
因此,算法将是一系列允许从某个地方到其他地方的步骤(使用地铁从家到工作也是一种算法)。
对于你的第二个问题:有两种大的类型(我正在简化)编程语言,“编译”和“interprated”,在后者中你有交互式或脚本语言。 另外,一般来说,脚本语言被认为是高级语言:你可以在几行中组成一个强大的东西,形成一个脚本。
当然一些脚本语言也可以编译....
For your first question : for me an algorithm can be an idea such as "to compute the sum of all the elements of the array you need to.....", a function (there is an input and un output and some steps in between) or a serie of mathematical operation.
So an algorithm would be a serie of steps that allow to go from somewhere to somewhere else (going from your home to your work using the subway is also an algorithm).
For your second question : there are two big types (I'm simplifying) of programming languages, the "compiled" ones and the "interprated" ones and among the latters you have the interactive ones or scripting languages. Also, generally speaking, scripting languages are considered high-levels ones : you can do powerful things in a few lines that together are forming a script.
Of course some scripting language can also be compiled....
相关问答
更多-
DPLL算法定义(DPLL algorithm definition)[2022-06-07]
DPLL要求以分离范式表述问题,即作为一组条款,每个条款都必须得到满足。 每个子句都是一组文字{l1, l2, ..., ln} ,表示这些文字的分离(即,至少一个文字必须对于要满足的子句是正确的)。 每个字面l声称某个变量是真( x )或是假( ~x )。 如果在一个条款中任何文字是真的,那么该条款是满意的。 如果一个条款中的所有文字都是错误的,那么该条款是不可满足的,因此这个问题是不可满足的。 解决方案是将真/假值分配给变量,以便满足每个子句。 DPLL算法是针对这种解决方案的优化搜索。 DPLL本质上 ... -
尖锐的(#)符号在vim脚本函数定义中意味着什么?(What does the sharp (#) sign mean in a vim script function definition?)[2023-05-18]
#是自动加载脚本。 尝试:h autoload获取更多信息。 我不认为允许“显式”函数结束,如vim帮助中所写: :endf[unction] The end of a function definition. Must be on a line by its own, without other commands. 但是看起来当你尝试把东西放在:endf ,即使它不是函数的名字,也不会发生错误。 The # is for autoload scripts. Try ... -
在这种情况下,您仍然将其称为jQuery对象上的属性,如下所示: jQuery(document).ready(function() { jQuery('#cancelID').click(function() { jQuery.modal.close(); }); }); 或者在ready函数中使用$ (它作为第一个参数传递),如下所示: jQuery(function($) { $('#cancelID').click(function() { ...
-
您可以使用eval运行字符串中定义的代码。 像这样: import sys x = load_some_data() function = eval("".join(sys.argv[1:])) print(function(x)) 使用您的具体示例,您可能必须使用lambda x: len(x) 正如@ Jan-Spurny正确地指出的那样:“永远,永远,永远不要使用eval,除非你绝对确定没有别的办法。即便如此,你应该停下来思考一下。” 在我看来,更好的策略是将数据加载器和执行器转换为一个模块,该模 ...
-
对你的问题的简短回答是,是的,这是可能的。 更长一点的答案是谷歌积极尝试用Captchas和其他反刮策略来阻止这种刮擦,因此像对谷歌进行15,000次调用这样简单的解决方案不可能比手动操作快得多。 幸运的是,有一个免费的库,旨在解决这个问题。 您可以在http://scraping.compunect.com/找到它。 (为了记录,我与图书馆的作者没有任何关系。) The short answer to your question is, yes, this is possible. The somewha ...
-
如上所述,正确的答案是: a)将SQL脚本保存在单独的文件中 b)有一个合适的版本控制系统(Git等) c)从版本控制系统部署 木已成舟。 As found, the correct answer is to: a) Maintain your SQL Scripts in separate files b) Have a proper versioning system (Git, etc.) c) Deploy from the versioning system Done Deal.
-
尝试制作它...... #!/bin/bash TIME_CMD='/usr/bin/time -f "%E execution time"' eval "$TIME_CMD ls" 这将利用bash在构造命令字符串后重新解析它,以便正确识别引用的参数。 Try making it... #!/bin/bash TIME_CMD='/usr/bin/time -f "%E execution time"' eval "$TIME_CMD ls" This will utilize bash to r ...
-
算法和脚本定义(Algorithm and script definition)[2022-10-30]
对于你的第一个问题:对我来说,一个算法可以是一个想法,如“计算你需要的数组的所有元素的总和......”,一个函数(有一个输入和un输出和一些步骤介于两者之间)或一系列数学运算。 因此,算法将是一系列允许从某个地方到其他地方的步骤(使用地铁从家到工作也是一种算法)。 对于你的第二个问题:有两种大的类型(我正在简化)编程语言,“编译”和“interprated”,在后者中你有交互式或脚本语言。 另外,一般来说,脚本语言被认为是高级语言:你可以在几行中组成一个强大的东西,形成一个脚本。 当然一些脚本语言也可以编 ... -
调用dbms_metadata.get_ddl是一种选择。 例如 SET LONG 10000 SELECT dbms_metadata.get_ddl('TABLE', 'MY-TABLE-NAME') FROM dual; 或者,许多GUI工具(包括TOAD和企业管理器)都有DDL生成器。 Calling dbms_metadata.get_ddl is one option. e.g. SET LONG 10000 SELECT dbms_metadata.get_ddl('TABLE', ...
-
我个人更喜欢使用哈希映射/字典来处理这些名称/值对。 所以你的代码可以写成: var buttonMap:Dictionary = new Dictionary(); buttonMap["TD_g"] = "Tweedlee_Dee"; buttonMap["s_g"] = "Sincerely"; buttonMap["ats_g"] = "Ain’_that_a_shame"; buttonMap["iyk_g"] = "I_hear_you_knocking"; buttonMap["hms_g"] ...