案例:jQuery UI案例     状态:可编辑再运行    进入竖版
 运行结果 
AخA
 
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta charset="utf-8">
5
  <title>jQuery UI 定位(Position) - 默认功能</title>
6
  <link rel="stylesheet" href="/css/jqu1.10.4/jquery-ui.min.css">
7
  <script src="/js/jqu/jquery.min1.10.2.js"></script>
8
  <script src="/js/jqu/jquery-ui.min1.10.4.js"></script>
9
  <link rel="stylesheet" href="jqueryui/style.css">
10
  <style>
11
  #parent {
12
    width: 60%;
13
    height: 40px;
14
    margin: 10px auto;
15
    padding: 5px;
16
    border: 1px solid #777;
17
    background-color: #fbca93;
18
    text-align: center;
19
  }
20
  .positionable {
21
    position: absolute;
22
    display: block;
23
    right: 0;
24
    bottom: 0;
25
    background-color: #bcd5e6;
26
    text-align: center;
27
  }
28
  #positionable1 {
29
    width: 75px;
30
    height: 75px;
31
  }
32
  #positionable2 {
33
    width: 120px;
34
    height: 40px;
35
  }
36
  select, input {
37
    margin-left: 15px;
38
  }
39
  </style>
40
  <script>
41
  $(function() {
42
    function position() {
43
      $( ".positionable" ).position({
44
        of: $( "#parent" ),
45
        my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
46
        at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
47
        collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
48
      });