showimg.js
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$(document).ready(function(){
$("img[name='show_img']").click(function() {
var imgsrc = $(this).attr('src');
$('#img_alert .img_content img').attr('src', imgsrc);
$('#img_alert').show();
var height = $('#img_alert .img_content').height();
$('#img_alert .img_content').css({
'margin-top': -(height / 2),
'opacity': '1'
})
})
$('#img_alert .img_content .closed').click(function(){
$(this).parents('.img_content').css({
'opacity': '0'
})
$('#img_alert').hide();
})
});
/*
$("img[name='show_img']").click(function() {
var imgsrc = $(this).attr('src');
$('#img_alert .img_content img').attr('src', imgsrc);
$('#img_alert').show();
var height = $('#img_alert .img_content').height();
if(height==0){
height = -250;
}else {
height = -(height / 2);
}
$('#img_alert .img_content').css({
'margin-top': height,
'opacity': '1'
})
})
$('#img_alert .img_content .closed').click(function(){
$(this).parents('.img_content').css({
'opacity': '0'
})
$('#img_alert').hide();
})*/