forked from romka-chev/yii2-swiper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path31-custom-plugin.php
82 lines (80 loc) · 2.21 KB
/
31-custom-plugin.php
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
<?php
/**
* @var \yii\web\View $this
*/
use bestyii\swiper\Swiper;
echo Swiper::widget( [
'items' => [
'Slide 1',
'Slide 2',
'Slide 3',
'Slide 4',
'Slide 5',
'Slide 6',
'Slide 7',
'Slide 8',
'Slide 9',
'Slide 10',
],
'behaviours' => [
Swiper::BEHAVIOUR_PAGINATION,
Swiper::BEHAVIOUR_NEXT_BUTTON,
Swiper::BEHAVIOUR_PREV_BUTTON
],
'nextButtonOptions' => [
'class' => 'swiper-button-white'
],
'prevButtonOptions' => [
'class' => 'swiper-button-white'
],
'pluginOptions' => [
Swiper::OPTION_PAGINATION_CLICKABLE => true,
'debugger' => true
]
] );
$this->registerJs( <<<JS
//noinspection ReservedWordAsName
Swiper.prototype.plugins.debugger = function ( swiper, params ) {
if (! params) {
return;
}
// Need to return object with properties that names are the same as callbacks
//noinspection JSUnusedLocalSymbols
return {
onInit : function ( swiper ) {
console.log( 'onInit' );
},
onClick : function ( swiper, e ) {
console.log( 'onClick' );
},
onTap : function ( swiper, e ) {
console.log( 'onTap' );
},
onDoubleTap : function ( swiper, e ) {
console.log( 'onDoubleTap' );
},
onSliderMove : function ( swiper, e ) {
console.log( 'onSliderMove' );
},
onSlideChangeStart: function ( swiper ) {
console.log( 'onSlideChangeStart' );
},
onSlideChangeEnd : function ( swiper ) {
console.log( 'onSlideChangeEnd' );
},
onTransitionStart : function ( swiper ) {
console.log( 'onTransitionStart' );
},
onTransitionEnd : function ( swiper ) {
console.log( 'onTransitionEnd' );
},
onReachBeginning : function ( swiper ) {
console.log( 'onReachBeginning' );
},
onReachEnd : function ( swiper ) {
console.log( 'onReachEnd' );
}
};
};
JS
, $this::POS_END );