Latest web development tutorials

jQuery UI API - slide effects (Slide Effect)

category

Special effects (Effects)

usage

Description: The elements slide out of the viewing area.

slide

参数 类型 描述 默认值
direction String 特效的方向。可能的值:"left"、"right"、"up"、"down"。 "both"
distance Number 特效的距离。默认为元素的高度(height)还是宽度(width)取决于 direction 参数。可以设置为小于元素的宽度(width)/高度(height)的任意整数。 元素的 outerWidth

Examples

Sliding effects (Slide Effect) switching a div.

<! Doctype html>
<Html lang = "en">
<Head>
  <Meta charset = "utf-8">
  <Title> slide effects (Slide Effect) Demo </ title>
  <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <Style>
  #toggle {
    width: 100px;
    height: 100px;
    background: #ccc;
  }
  </ Style>
  <Script src = "// code.jquery.com/jquery-1.10.2.js"> </ script>
  <Script src = "// code.jquery.com/ui/1.10.4/jquery-ui.js"> </ script>
</ Head>
<Body>
 
<P> Click anywhere to switch. </ P>
<Div id = "toggle"> </ div>
 
<Script>
$ (Document) .click (function () {
  $ ( "#toggle") .toggle ( "Slide");
});
</ Script>
 
</ Body>
</ Html>