Ajax Loader
×
HTML
<h1>Drag Anywere</h1>
1
<h1>Drag Anywere</h1>
2
<div id="drag"></div>
3
 
4
<script class="cssdeck" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
 
CSS
* {
1
* {
2
  cursor: default;
3
}
4
 
5
body {
6
  background-image: url("http://wallpapers.wallbase.cc/rozne/wallpaper-1873891.jpg");
7
  margin: 0;
8
  padding: 0;
9
}
10
 
11
h1 {
12
  color: white;
13
  text-shadow: 0px 0px 100px #000;
14
  text-align: center;
15
  font: 300% Segoe UI, Arial, sans-serif;
16
}
17
 
18
#drag {
19
  width: 200px;
20
  height: 300px;
21
  position: absolute;
22
  top: 100px;
23
  left: 300px;
24
  background: rgba(51, 153, 255, 0.3);
25
  border: 1px solid #3399ff;
26
  display: none;
27
}
 
JavaScript
var Gl = {
1
var Gl = {
2
  isDown: false
3
};
4
$(document).ready(function() {
5
  $(this)
6
    .mousedown(function(e) {
7
      $('h1').hide();
8
      $('#drag').show();
9
      Gl.isDown = true;
10
      Gl.tlx = e.pageX,
11
      Gl.tly = e.pageY;
12
      $('#drag').css({
13
        'top': Gl.tly,
14
        'left': Gl.tlx,
15
        'width': 0,
16
        'height': 0
17
      });
18
    })
19
    .mousemove(function(e) {
20
      if (Gl.isDown) {
21
        Gl.brx = e.pageX,
22
        Gl.bry = e.pageY;
23
        if ((Gl.brx > Gl.tlx) && (Gl.bry > Gl.tly)) {
24
          $('#drag').css({
25
            'width': Gl.brx - Gl.tlx,
26
            'height': Gl.bry - Gl.tly
27
          });
28
        } else if ((Gl.brx < Gl.tlx) && (Gl.bry > Gl.tly)) {
29
          $('#drag').css({
30
            'left': Gl.brx,
31
            'width': Gl.tlx - Gl.brx,
32
            'height': Gl.bry - Gl.tly
33
          });
34
        } else if ((Gl.brx > Gl.tlx) && (Gl.bry < Gl.tly)) {
35
          $('#drag').css({
36
            'top': Gl.bry,
37
            'width': Gl.brx - Gl.tlx,
38
            'height': Gl.tly - Gl.bry
39
          });
40
        } else if ((Gl.brx < Gl.tlx) && (Gl.bry < Gl.tly)) {
41
          $('#drag').css({
42
            'left': Gl.brx,
43
            'top': Gl.bry,
44
            'width': Gl.tlx - Gl.brx,
45
            'height': Gl.tly - Gl.bry
46
          });
47
        }
48
      };
49
    })
50
    .mouseup(function() {
51
      Gl.isDown = false;
52
    })
53
})
 

Windows Desktop Select

CSSDeck G+