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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//viewerjs插件引用
function show_viewer_more(link , id , name ,value) {
debugger;
var img ='';
var str = value.split(';;');
var div = document.createElement("div");
var initialViewIndex ='';
for (var i = 0;i < str.length;i++) {
var temp = str[i].split('--');
if (!Aurora.isEmpty(temp[0])) {
var file_name = temp[0].toUpperCase();
var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
img = img + '<li><img data-original="img/tibet-'+i+'.jpg" src="'+ link + temp[1] +'" alt="'+temp[0] +'"></li>';
}
if (id == temp[1]) {
initialViewIndex = i;
}
}
}
img = '<ul>'+img + '</ul>';
div.innerHTML=img;
div.id='view-imgs';
var viewer = new Viewer(div, {
hidden: function() {
viewer.destroy();
},
toolbar: {
zoomIn: 3,
zoomOut: 3,
oneToOne: 3,
reset: 3,
prev: 3,
play: {
show: 3,
size: 'large',
},
next: 3,
rotateLeft: 3,
rotateRight: 3,
flipHorizontal: 3,
flipVertical: 3,
},
navbar:0,
});
//这个就是点开那张图片就是那张图片,从点开图片的那张开始
viewer.view(initialViewIndex);
//默认展示容器从第一张开始
//viewer.show();
}
//附件预览页面,图片点击事件
Ext.fly(document).on('click', function(ev){
//获取图片超链接
var target = ev.getTarget('a[ref=img]');
if (target) {
ev.preventDefault();//取消事件的默认动作。
//调用单张图片预览方法
//show_viewer_singer(target.href, target.title);
}
}, this);
function show_viewer_singer(src, name) {
var image = new Image();
image.src = src;
image.alt = name;
var viewer = new Viewer(image, {
hidden: function() {
viewer.destroy();
},
toolbar: {
zoomIn: 3,
zoomOut: 3,
oneToOne: 3,
reset: 3,
prev: 3,
play: {
show: 3,
size: 'large',
},
next: 3,
rotateLeft: 3,
rotateRight: 3,
flipHorizontal: 3,
flipVertical: 3,
},
});
viewer.show();
}