Home>

jqueryqueue () method anddequeue () method,Can complete the operation on the function queue.

Implementation steps:

1. Create a new function array,Put animation functions in order;

2.Callqueue () method adds an array of animation functions to the queue;

3.Usedequeue () method takes the first function in the function queue,And execute it.

Example:

<! Doctype html>
<html>
 <head>
  <title>jqueryqueuetest.html</title>
  <meta http-equiv="keywords" content="keyword1, keyword2, keyword3">
  <meta http-equiv="description" content="this is my page">
  <meta http-equiv="content-type" content="text/html;charset=utf-8">
  <script src="http://libs.google.com/jquery/2.0.0/jquery.min.js"></script>
  <script type="text/javascript">
  $(). ready (function () {
  $(". flip"). click (function () {//Bind the click event to the flip class
  var _slidefun=[
  function () {
  $(". panel"). slideup (1200, _takeone);
  },  function () {
  $(". panel"). fadein (1600, _takeone);
  }
  ];//Create a function array with 2 functions
  $(". panel"). queue ("slidelist", _ slidefun);//Set the function queue through the queue method
  var _takeone=function () {
  $(". panel"). dequeue ("slidelist");
  };//Define an event handler,The function of this program is:remove a queue function from the front of the function queue,Get the next function execution in the queue
  _takeone ();//Execute the next function in the function queue
  });
  });
  </script>
<style type="text/css">
div.panel, p.flip
{
margin:0px;
padding:5px;
text_align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
height:120px;
}
</style>
 </head>
 <body>
  <div>
  <p>Animation queue effect</p>
  </div>
 </body>
</html>
  • Previous Complete instance of stored procedure extension class rewritten for thinkPHP5 framework stored procedure bug
  • Next Detailed JSONparseObject and JSONtoJSONString instances
  • Trends