QRcode.page.js
1.04 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
44
45
var $ = require('yoho-jquery');
var Slide = require('../plugins/yohoui/YH.slide');
var $item = $('li', '.qrctxt');
var len = $item.length, slide;
function slideDo(to) {
$item.each(function(index) {
index === to ? $(this).stop().animate({
opacity: 1,
zIndex: 1
}, 400) : $(this).stop().animate({
opacity: 0,
zIndex: 0
}, 400);
to === 0 ? $('.prev').addClass('gray') : $('.prev').removeClass('gray');
to === len - 1 ? $('.next').addClass('gray') : $('.next').removeClass('gray');
});
}
slideDo(0);
slide = new Slide({
length: len,
loop: false,
auto: false,
timeout: 2,
index: 0
});
slide.on('change', function(data) {
slideDo(data.to);
});
$('.prev', '.qrcmain-switch').click(function() {
slide.prev();
});
$('.next', '.qrcmain-switch').click(function() {
slide.next();
});
$('.btn-qcode').click(function(){
document.body.innerHTML=$("ul li",".qrctxt").eq(slide.options.index).html();
window.print();
return false;
});