JSDM

HTML

5
 
1
div.container
2
  a     
3
    img(src='http://img.sc115.com/uploads/png/110125/201101251547085508.png') 
4
div.popup 
5
  div.close.fa.fa-times
!

CSS

xxxxxxxxxx
25
 
1
body
2
  background-color #f7eecd
3
.container
4
  position absolute
5
  transform translate(-50%,-50%)
6
  top 50%
7
  left 50%
8
  a
9
    img
10
      width 256px
11
      height 256px
12
      transition width 0.5s, height 0.5s;
13
  a:hover
14
    img
15
      width 300px
16
      height 300px
17
.popup
18
  width 240px
19
  height 240px
20
  background url('http://img.web07.cn/UpPic/Png/201404/28/5697280852151-lp.png')
21
  display none
22
  .close
23
    position absolute
24
    top 0
25
    right 0
!
? ?
? ?
必须是有效的URL
+ 添加另一个资源

JS

43
 
1
function isExist(elem){
2
  if(typeof elem !== 'undefined' && typeof elem !== null) {
3
    return true;
4
  }else{
5
    return false; 
6
  }
7
}
8
var addCover = function(){    
9
  removeCover();
10
  var coverCss = {
11
    position: 'fixed',
12
    zIndex: '100',
13
    top : '0px',
14
    left: '0px',
15
    bottom: '0px',
16
    right: '0px',
17
    backgroundColor:'#000',
18
    opacity: 0.6
19
  }
20
  var cover = $('<div id="cover" class="mask"/>');    
21
  $('body').append(cover.css(coverCss));
22
}
23
var removeCover = function(){
24
  if(isExist($('#cover'))) $('#cover').remove();
25
}
26
27
function popup(target){
28
  addCover();
29
  target.css('position','fixed')
30
      .css("top",($(window).height()-target.height())/2)
31
      .css("left",($(window).width()-target.width())/2)
32
      .css("z-index","9999")
33
      .fadeIn();
34
  $(".close").on('click',function(){
35
    removeCover();
36
    target.fadeOut();
37
    return false;
38
  });
39
}
40
$('a').on('click',function(){
41
  popup($('.popup'))
42
})
43
!
必须是有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

  1. 暂无文件
拖动文件到上面的区域或者:
加载中 ..................