metro-ui-rails 0.1.3 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/Rakefile +73 -0
- data/lib/metro/ui/rails/engine.rb +1 -0
- data/lib/metro/ui/rails/version.rb +1 -1
- data/vendor/assets/fonts/metro-ui/iconFont.eot +0 -0
- data/vendor/assets/fonts/metro-ui/iconFont.svg +1956 -0
- data/vendor/assets/fonts/metro-ui/iconFont.ttf +0 -0
- data/vendor/assets/fonts/metro-ui/iconFont.woff +0 -0
- data/vendor/assets/images/{metro/ui → metro-ui}/pull24-dark.png +0 -0
- data/vendor/assets/images/{metro/ui → metro-ui}/row24.png +0 -0
- data/vendor/assets/javascripts/metro-ui.js +4 -0
- data/vendor/assets/javascripts/metro-ui/accordion.js +1 -1
- data/vendor/assets/javascripts/metro-ui/carousel.js +368 -0
- data/vendor/assets/javascripts/metro-ui/dropdown.js +3 -2
- data/vendor/assets/javascripts/metro-ui/pagecontrol.js +29 -6
- data/vendor/assets/javascripts/metro-ui/rating.js +46 -0
- data/vendor/assets/javascripts/metro-ui/slider.js +248 -0
- data/vendor/assets/javascripts/metro-ui/tile-slider.js +196 -0
- data/vendor/toolkit/metro-ui/accordion.less +8 -0
- data/vendor/toolkit/metro-ui/bricks.less +1 -1
- data/vendor/toolkit/metro-ui/buttons.less +137 -11
- data/vendor/toolkit/metro-ui/cards.less +1 -1
- data/vendor/toolkit/metro-ui/carousel.less +109 -0
- data/vendor/toolkit/metro-ui/code.less +1 -2
- data/vendor/toolkit/metro-ui/colors.less +49 -6
- data/vendor/toolkit/metro-ui/forms.less +5 -5
- data/vendor/toolkit/metro-ui/grid.less +5 -2
- data/vendor/toolkit/metro-ui/hero.less +2 -2
- data/vendor/toolkit/metro-ui/icons.less +376 -0
- data/vendor/toolkit/metro-ui/images.less +1 -1
- data/vendor/toolkit/metro-ui/layout.less +15 -1
- data/vendor/toolkit/metro-ui/listview.less +143 -0
- data/vendor/toolkit/metro-ui/menus.less +62 -6
- data/vendor/toolkit/metro-ui/modern-responsive-max480.less +15 -63
- data/vendor/toolkit/metro-ui/modern-responsive-max767.less +139 -0
- data/vendor/toolkit/metro-ui/modern-responsive-max979.less +9 -4
- data/vendor/toolkit/metro-ui/modern-responsive-min1200.less +12 -0
- data/vendor/toolkit/metro-ui/modern-responsive.less +8 -0
- data/vendor/toolkit/metro-ui/modern.less +8 -1
- data/vendor/toolkit/metro-ui/notices.less +4 -2
- data/vendor/toolkit/metro-ui/pagecontrol.less +12 -2
- data/vendor/toolkit/metro-ui/progress.less +22 -0
- data/vendor/toolkit/metro-ui/rating.less +80 -0
- data/vendor/toolkit/metro-ui/routines.less +2 -1
- data/vendor/toolkit/metro-ui/sidebar.less +136 -0
- data/vendor/toolkit/metro-ui/slider.less +67 -0
- data/vendor/toolkit/metro-ui/tables.less +5 -4
- data/vendor/toolkit/metro-ui/theme-dark.less +5 -1
- data/vendor/toolkit/metro-ui/tiles.less +48 -56
- data/vendor/toolkit/metro-ui/typography.less +1 -15
- metadata +21 -59
- data/vendor/assets/images/.DS_Store +0 -0
- data/vendor/assets/images/metro/.DS_Store +0 -0
- data/vendor/assets/images/metro/ui/.DS_Store +0 -0
- data/vendor/assets/images/metro/ui/Calendar128.png +0 -0
- data/vendor/assets/images/metro/ui/Camera48.png +0 -0
- data/vendor/assets/images/metro/ui/InternetExplorer128.png +0 -0
- data/vendor/assets/images/metro/ui/Mail128.png +0 -0
- data/vendor/assets/images/metro/ui/Market128.png +0 -0
- data/vendor/assets/images/metro/ui/Music128.png +0 -0
- data/vendor/assets/images/metro/ui/Picture128.png +0 -0
- data/vendor/assets/images/metro/ui/Rss128.png +0 -0
- data/vendor/assets/images/metro/ui/Video128.png +0 -0
- data/vendor/assets/images/metro/ui/YouTube128.png +0 -0
- data/vendor/assets/images/metro/ui/armor.png +0 -0
- data/vendor/assets/images/metro/ui/bage-activity.png +0 -0
- data/vendor/assets/images/metro/ui/bage-alert.png +0 -0
- data/vendor/assets/images/metro/ui/bage-attention.png +0 -0
- data/vendor/assets/images/metro/ui/bage-available.png +0 -0
- data/vendor/assets/images/metro/ui/bage-away.png +0 -0
- data/vendor/assets/images/metro/ui/bage-busy.png +0 -0
- data/vendor/assets/images/metro/ui/bage-error.png +0 -0
- data/vendor/assets/images/metro/ui/bage-newMessage.png +0 -0
- data/vendor/assets/images/metro/ui/bage-paused.png +0 -0
- data/vendor/assets/images/metro/ui/bage-playing.png +0 -0
- data/vendor/assets/images/metro/ui/bage-unavailable.png +0 -0
- data/vendor/assets/images/metro/ui/chrome.png +0 -0
- data/vendor/assets/images/metro/ui/collapse24-black.png +0 -0
- data/vendor/assets/images/metro/ui/collapse24.png +0 -0
- data/vendor/assets/images/metro/ui/collapse32-black.png +0 -0
- data/vendor/assets/images/metro/ui/collapse32.png +0 -0
- data/vendor/assets/images/metro/ui/download-32.png +0 -0
- data/vendor/assets/images/metro/ui/excel2013icon.png +0 -0
- data/vendor/assets/images/metro/ui/expand24-black.png +0 -0
- data/vendor/assets/images/metro/ui/expand24.png +0 -0
- data/vendor/assets/images/metro/ui/expand32-black.png +0 -0
- data/vendor/assets/images/metro/ui/expand32.png +0 -0
- data/vendor/assets/images/metro/ui/firefox.png +0 -0
- data/vendor/assets/images/metro/ui/fork-32.png +0 -0
- data/vendor/assets/images/metro/ui/github.png +0 -0
- data/vendor/assets/images/metro/ui/grid.png +0 -0
- data/vendor/assets/images/metro/ui/ie.png +0 -0
- data/vendor/assets/images/metro/ui/lock-open.png +0 -0
- data/vendor/assets/images/metro/ui/lock.png +0 -0
- data/vendor/assets/images/metro/ui/logo32.png +0 -0
- data/vendor/assets/images/metro/ui/onenote2013icon.png +0 -0
- data/vendor/assets/images/metro/ui/opera.png +0 -0
- data/vendor/assets/images/metro/ui/pull24.png +0 -0
- data/vendor/assets/images/metro/ui/responsive.png +0 -0
- data/vendor/assets/images/metro/ui/shield-user.png +0 -0
- data/vendor/assets/images/metro/ui/simple.png +0 -0
- data/vendor/assets/images/metro/ui/star32.png +0 -0
- data/vendor/assets/images/metro/ui/stock-up.png +0 -0
- data/vendor/assets/images/metro/ui/view-32.png +0 -0
- data/vendor/assets/images/metro/ui/word2013icon.png +0 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
(function($){
|
2
|
+
$.fn.Rating = function( options ){
|
3
|
+
var defaults = {
|
4
|
+
};
|
5
|
+
|
6
|
+
var $this = $(this)
|
7
|
+
;
|
8
|
+
|
9
|
+
var init = function(el){
|
10
|
+
var a = el.find("a");
|
11
|
+
var r = Math.round(el.data("rating")) || 0;
|
12
|
+
|
13
|
+
a.each(function(index){
|
14
|
+
console.log(index);
|
15
|
+
if (index < r) {
|
16
|
+
$(this).addClass("rated");
|
17
|
+
}
|
18
|
+
|
19
|
+
$(this).hover(
|
20
|
+
function(){
|
21
|
+
$(this).prevAll().andSelf().addClass("hover");
|
22
|
+
$(this).nextAll().removeClass("hover");
|
23
|
+
},
|
24
|
+
function(){
|
25
|
+
$(this).prevAll().andSelf().removeClass("hover");
|
26
|
+
}
|
27
|
+
)
|
28
|
+
})
|
29
|
+
|
30
|
+
}
|
31
|
+
|
32
|
+
return this.each(function(){
|
33
|
+
if ( options ) {
|
34
|
+
$.extend(defaults, options)
|
35
|
+
}
|
36
|
+
|
37
|
+
init($this);
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
$(function () {
|
42
|
+
$('[data-role="rating"]').each(function () {
|
43
|
+
$(this).Rating();
|
44
|
+
})
|
45
|
+
})
|
46
|
+
})(window.jQuery);
|
@@ -0,0 +1,248 @@
|
|
1
|
+
/**
|
2
|
+
* Slider - jQuery plugin for MetroUiCss framework
|
3
|
+
*
|
4
|
+
* there is "change" event triggering when marker moving
|
5
|
+
* and "changed" event when stop moving
|
6
|
+
*
|
7
|
+
* you may use this code to handle events:
|
8
|
+
|
9
|
+
$(window).ready(function(){
|
10
|
+
$('.slider').on('change', function(e, val){
|
11
|
+
console.log('change to ' + val);
|
12
|
+
}).on('changed', function(e, val){
|
13
|
+
console.log('changed to ' + val);
|
14
|
+
});
|
15
|
+
});
|
16
|
+
|
17
|
+
* and this, to retrieve value
|
18
|
+
|
19
|
+
$('.slider').data('value')
|
20
|
+
|
21
|
+
*
|
22
|
+
*/
|
23
|
+
|
24
|
+
(function($) {
|
25
|
+
|
26
|
+
$.slider = function(element, options) {
|
27
|
+
|
28
|
+
// default settings
|
29
|
+
var defaults = {
|
30
|
+
// start value of slider
|
31
|
+
initValue: 0,
|
32
|
+
// accuracy
|
33
|
+
accuracy: 1
|
34
|
+
};
|
35
|
+
|
36
|
+
var plugin = this;
|
37
|
+
plugin.settings = {};
|
38
|
+
|
39
|
+
var $element = $(element); // reference to the jQuery version of DOM element
|
40
|
+
|
41
|
+
var complete, // complete part element
|
42
|
+
marker, // marker element
|
43
|
+
currentValuePerc, // current percents count
|
44
|
+
sliderLength,
|
45
|
+
sliderOffset,
|
46
|
+
sliderStart,
|
47
|
+
sliderEnd,
|
48
|
+
percentPerPixel,
|
49
|
+
markerSize,
|
50
|
+
vertical = false;
|
51
|
+
|
52
|
+
// initialization
|
53
|
+
plugin.init = function () {
|
54
|
+
|
55
|
+
plugin.settings = $.extend({}, defaults, options);
|
56
|
+
|
57
|
+
// create inside elements
|
58
|
+
complete = $('<div class="complete"></div>');
|
59
|
+
marker = $('<div class="marker"></div>');
|
60
|
+
|
61
|
+
complete.appendTo($element);
|
62
|
+
marker.appendTo($element);
|
63
|
+
|
64
|
+
vertical = $element.hasClass('vertical');
|
65
|
+
|
66
|
+
initGeometry();
|
67
|
+
|
68
|
+
// start value
|
69
|
+
currentValuePerc = correctValuePerc(plugin.settings.initValue);
|
70
|
+
placeMarkerByPerc(currentValuePerc);
|
71
|
+
|
72
|
+
// init marker handler
|
73
|
+
marker.on('mousedown', function (e) {
|
74
|
+
e.preventDefault();
|
75
|
+
startMoveMarker();
|
76
|
+
});
|
77
|
+
|
78
|
+
$element.on('click', function (event) {
|
79
|
+
initGeometry();
|
80
|
+
movingMarker(event);
|
81
|
+
$element.trigger('changed', [currentValuePerc]);
|
82
|
+
});
|
83
|
+
|
84
|
+
};
|
85
|
+
|
86
|
+
/**
|
87
|
+
* correct percents using "accuracy" parameter
|
88
|
+
*/
|
89
|
+
var correctValuePerc = function (value) {
|
90
|
+
var accuracy = plugin.settings.accuracy;
|
91
|
+
if (accuracy === 0) {
|
92
|
+
return value;
|
93
|
+
}
|
94
|
+
if (value === 100) {
|
95
|
+
return 100;
|
96
|
+
}
|
97
|
+
value = Math.floor(value / accuracy) * accuracy + Math.round(value % accuracy / accuracy) * accuracy;
|
98
|
+
if (value > 100) {
|
99
|
+
return 100;
|
100
|
+
}
|
101
|
+
return value;
|
102
|
+
};
|
103
|
+
|
104
|
+
/**
|
105
|
+
* convert pixels to percents
|
106
|
+
*/
|
107
|
+
var pixToPerc = function (valuePix) {
|
108
|
+
var valuePerc;
|
109
|
+
valuePerc = valuePix * percentPerPixel;
|
110
|
+
return correctValuePerc(valuePerc);
|
111
|
+
};
|
112
|
+
|
113
|
+
/**
|
114
|
+
* convert percents to pixels
|
115
|
+
*/
|
116
|
+
var percToPix = function (value) {
|
117
|
+
if (percentPerPixel === 0) {
|
118
|
+
return 0;
|
119
|
+
}
|
120
|
+
return value / percentPerPixel;
|
121
|
+
};
|
122
|
+
|
123
|
+
/**
|
124
|
+
* place marker
|
125
|
+
*/
|
126
|
+
var placeMarkerByPerc = function (valuePerc) {
|
127
|
+
var size, size2;
|
128
|
+
|
129
|
+
if (vertical) {
|
130
|
+
size = percToPix(valuePerc) + markerSize;
|
131
|
+
size2 = sliderLength - size;
|
132
|
+
marker.css('top', size2);
|
133
|
+
complete.css('height', size);
|
134
|
+
} else {
|
135
|
+
size = percToPix(valuePerc);
|
136
|
+
marker.css('left', size);
|
137
|
+
complete.css('width', size);
|
138
|
+
}
|
139
|
+
|
140
|
+
};
|
141
|
+
|
142
|
+
/**
|
143
|
+
* when mousedown on marker
|
144
|
+
*/
|
145
|
+
var startMoveMarker = function () {
|
146
|
+
// register event handlers
|
147
|
+
$(document).on('mousemove.sliderMarker', function (event) {
|
148
|
+
movingMarker(event);
|
149
|
+
});
|
150
|
+
$(document).on('mouseup.sliderMarker', function () {
|
151
|
+
$(document).off('mousemove.sliderMarker');
|
152
|
+
$(document).off('mouseup.sliderMarker');
|
153
|
+
$element.data('value', currentValuePerc);
|
154
|
+
$element.trigger('changed', [currentValuePerc]);
|
155
|
+
});
|
156
|
+
|
157
|
+
initGeometry();
|
158
|
+
};
|
159
|
+
|
160
|
+
/**
|
161
|
+
* some geometry slider parameters
|
162
|
+
*/
|
163
|
+
var initGeometry = function () {
|
164
|
+
if (vertical) {
|
165
|
+
sliderLength = $element.height(); // slider element length
|
166
|
+
sliderOffset = $element.offset().top; // offset relative to document edge
|
167
|
+
markerSize = marker.height();
|
168
|
+
} else {
|
169
|
+
sliderLength = $element.width();
|
170
|
+
sliderOffset = $element.offset().left;
|
171
|
+
markerSize = marker.width();
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
percentPerPixel = 100 / (sliderLength - markerSize); // it depends on slider element size
|
176
|
+
sliderStart = markerSize / 2;
|
177
|
+
sliderEnd = sliderLength - markerSize / 2;
|
178
|
+
};
|
179
|
+
|
180
|
+
/**
|
181
|
+
* moving marker
|
182
|
+
*/
|
183
|
+
var movingMarker = function (event) {
|
184
|
+
var cursorPos,
|
185
|
+
percents,
|
186
|
+
valuePix;
|
187
|
+
|
188
|
+
// cursor position relative to slider start point
|
189
|
+
if (vertical) {
|
190
|
+
cursorPos = event.pageY - sliderOffset;
|
191
|
+
} else {
|
192
|
+
cursorPos = event.pageX - sliderOffset;
|
193
|
+
}
|
194
|
+
|
195
|
+
// if outside
|
196
|
+
if (cursorPos < sliderStart) {
|
197
|
+
cursorPos = sliderStart;
|
198
|
+
} else if (cursorPos > sliderEnd) {
|
199
|
+
cursorPos = sliderEnd;
|
200
|
+
}
|
201
|
+
|
202
|
+
// get pixels count
|
203
|
+
if (vertical) {
|
204
|
+
valuePix = sliderLength - cursorPos - markerSize / 2;
|
205
|
+
} else {
|
206
|
+
valuePix = cursorPos - markerSize / 2;
|
207
|
+
}
|
208
|
+
|
209
|
+
// convert to percent
|
210
|
+
percents = pixToPerc(valuePix);
|
211
|
+
|
212
|
+
// place marker
|
213
|
+
placeMarkerByPerc(percents);
|
214
|
+
|
215
|
+
currentValuePerc = percents;
|
216
|
+
|
217
|
+
$element.trigger('change', [currentValuePerc]);
|
218
|
+
};
|
219
|
+
|
220
|
+
|
221
|
+
plugin.init();
|
222
|
+
|
223
|
+
};
|
224
|
+
|
225
|
+
$.fn.slider = function(options) {
|
226
|
+
return this.each(function() {
|
227
|
+
if (undefined == $(this).data('slider')) {
|
228
|
+
var plugin = new $.slider(this, options);
|
229
|
+
$(this).data('slider', plugin);
|
230
|
+
}
|
231
|
+
});
|
232
|
+
};
|
233
|
+
|
234
|
+
|
235
|
+
})(jQuery);
|
236
|
+
|
237
|
+
|
238
|
+
$(window).ready(function(){
|
239
|
+
var allsliders = $('[data-role=slider], .slider');
|
240
|
+
allsliders.each(function (index, slider) {
|
241
|
+
var params = {};
|
242
|
+
$slider = $(slider);
|
243
|
+
params.initValue = $slider.data('paramInitValue');
|
244
|
+
params.accuracy = $slider.data('paramAccuracy');
|
245
|
+
|
246
|
+
$slider.slider(params);
|
247
|
+
});
|
248
|
+
});
|
@@ -0,0 +1,196 @@
|
|
1
|
+
$.easing.doubleSqrt = function(t, millisecondsSince, startValue, endValue, totalDuration) {
|
2
|
+
var res = Math.sqrt(Math.sqrt(t));
|
3
|
+
return res;
|
4
|
+
};
|
5
|
+
|
6
|
+
(function($) {
|
7
|
+
|
8
|
+
$.tileBlockSlider = function(element, options) {
|
9
|
+
|
10
|
+
// настройки по умолчанию
|
11
|
+
var defaults = {
|
12
|
+
// период смены картинок
|
13
|
+
period: 2000,
|
14
|
+
// продолжительность анимации
|
15
|
+
duration: 1000,
|
16
|
+
// направление анимации (up, down, left, right)
|
17
|
+
direction: 'up'
|
18
|
+
};
|
19
|
+
// объект плагина
|
20
|
+
var plugin = this;
|
21
|
+
// настройки конкретного объекта
|
22
|
+
plugin.settings = {};
|
23
|
+
|
24
|
+
var $element = $(element), // reference to the jQuery version of DOM element
|
25
|
+
element = element; // reference to the actual DOM element
|
26
|
+
|
27
|
+
var blocks, // все картинки
|
28
|
+
currentBlockIndex, // индекс текущего блока
|
29
|
+
slideInPosition, // стартовое положение блока перед началом появления
|
30
|
+
slideOutPosition, // финальное положение блока при скрытии
|
31
|
+
tileWidth, // размеры плитки
|
32
|
+
tileHeight;
|
33
|
+
|
34
|
+
// инициализируем
|
35
|
+
plugin.init = function () {
|
36
|
+
|
37
|
+
plugin.settings = $.extend({}, defaults, options);
|
38
|
+
|
39
|
+
// все блоки
|
40
|
+
blocks = $element.children(".tile-content");
|
41
|
+
|
42
|
+
// если блок всего 1, то слайдинг не нужен
|
43
|
+
if (blocks.length <= 1) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
// индекс активного в данный момент блока
|
48
|
+
currentBlockIndex = 0;
|
49
|
+
|
50
|
+
// размеры текущей плитки
|
51
|
+
tileWidth = $element.innerWidth();
|
52
|
+
tileHeight = $element.innerHeight();
|
53
|
+
// положение блоков
|
54
|
+
slideInPosition = getSlideInPosition();
|
55
|
+
slideOutPosition = getSlideOutPosition();
|
56
|
+
|
57
|
+
// подготавливаем блоки к анимации
|
58
|
+
blocks.each(function (index, block) {
|
59
|
+
block = $(block);
|
60
|
+
// блоки должны быть position:absolute
|
61
|
+
// возможно этот параметр задан через класс стилей
|
62
|
+
// проверяем, и добавляем если это не так
|
63
|
+
if (block.css('position') !== 'absolute') {
|
64
|
+
block.css('position', 'absolute');
|
65
|
+
}
|
66
|
+
// скрываем все блоки кроме первого
|
67
|
+
if (index !== 0) {
|
68
|
+
block.css('left', tileWidth);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
// запускаем интервал для смены блоков
|
73
|
+
setInterval(function () {
|
74
|
+
slideBlock();
|
75
|
+
}, plugin.settings.period);
|
76
|
+
};
|
77
|
+
|
78
|
+
// смена блоков
|
79
|
+
var slideBlock = function() {
|
80
|
+
|
81
|
+
var slideOutBlock, // блок который надо скрыть
|
82
|
+
slideInBlock, // блок который надо показать
|
83
|
+
mainPosition = {'left': 0, 'top': 0},
|
84
|
+
options;
|
85
|
+
|
86
|
+
slideOutBlock = $(blocks[currentBlockIndex]);
|
87
|
+
|
88
|
+
currentBlockIndex++;
|
89
|
+
if (currentBlockIndex >= blocks.length) {
|
90
|
+
currentBlockIndex = 0;
|
91
|
+
}
|
92
|
+
slideInBlock = $(blocks[currentBlockIndex]);
|
93
|
+
|
94
|
+
slideInBlock.css(slideInPosition);
|
95
|
+
|
96
|
+
options = {
|
97
|
+
duration: plugin.settings.duration,
|
98
|
+
easing: 'doubleSqrt'
|
99
|
+
};
|
100
|
+
|
101
|
+
slideOutBlock.animate(slideOutPosition, options);
|
102
|
+
slideInBlock.animate(mainPosition, options);
|
103
|
+
};
|
104
|
+
|
105
|
+
/**
|
106
|
+
* возвращает стартовую позицию для блока который должен появиться {left: xxx, top: yyy}
|
107
|
+
*/
|
108
|
+
var getSlideInPosition = function () {
|
109
|
+
var pos;
|
110
|
+
if (plugin.settings.direction === 'left') {
|
111
|
+
pos = {
|
112
|
+
'left': tileWidth,
|
113
|
+
'top': 0
|
114
|
+
}
|
115
|
+
} else if (plugin.settings.direction === 'right') {
|
116
|
+
pos = {
|
117
|
+
'left': -tileWidth,
|
118
|
+
'top': 0
|
119
|
+
}
|
120
|
+
} else if (plugin.settings.direction === 'up') {
|
121
|
+
pos = {
|
122
|
+
'left': 0,
|
123
|
+
'top': tileHeight
|
124
|
+
}
|
125
|
+
} else if (plugin.settings.direction === 'down') {
|
126
|
+
pos = {
|
127
|
+
'left': 0,
|
128
|
+
'top': -tileHeight
|
129
|
+
}
|
130
|
+
}
|
131
|
+
return pos;
|
132
|
+
};
|
133
|
+
|
134
|
+
/**
|
135
|
+
* возвращает финальную позицию для блока который должен скрыться {left: xxx, top: yyy}
|
136
|
+
*/
|
137
|
+
var getSlideOutPosition = function () {
|
138
|
+
var pos;
|
139
|
+
if (plugin.settings.direction === 'left') {
|
140
|
+
pos = {
|
141
|
+
'left': -tileWidth,
|
142
|
+
'top': 0
|
143
|
+
}
|
144
|
+
} else if (plugin.settings.direction === 'right') {
|
145
|
+
pos = {
|
146
|
+
'left': tileWidth,
|
147
|
+
'top': 0
|
148
|
+
}
|
149
|
+
} else if (plugin.settings.direction === 'up') {
|
150
|
+
pos = {
|
151
|
+
'left': 0,
|
152
|
+
'top': -tileHeight
|
153
|
+
}
|
154
|
+
} else if (plugin.settings.direction === 'down') {
|
155
|
+
pos = {
|
156
|
+
'left': 0,
|
157
|
+
'top': tileHeight
|
158
|
+
}
|
159
|
+
}
|
160
|
+
return pos;
|
161
|
+
};
|
162
|
+
|
163
|
+
plugin.getParams = function() {
|
164
|
+
|
165
|
+
// code goes here
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
plugin.init();
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
$.fn.tileBlockSlider = function(options) {
|
174
|
+
return this.each(function() {
|
175
|
+
if (undefined == $(this).data('tileBlockSlider')) {
|
176
|
+
var plugin = new $.tileBlockSlider(this, options);
|
177
|
+
$(this).data('tileBlockSlider', plugin);
|
178
|
+
}
|
179
|
+
});
|
180
|
+
}
|
181
|
+
|
182
|
+
})(jQuery);
|
183
|
+
|
184
|
+
|
185
|
+
$(window).ready(function(){
|
186
|
+
var slidedTiles = $('[data-role=tile-slider], .block-slider, .tile-slider');
|
187
|
+
slidedTiles.each(function (index, tile) {
|
188
|
+
var params = {};
|
189
|
+
tile = $(tile);
|
190
|
+
params.direction = tile.data('paramDirection');
|
191
|
+
params.duration = tile.data('paramDuration');
|
192
|
+
params.period = tile.data('paramPeriod');
|
193
|
+
tile.tileBlockSlider(params);
|
194
|
+
})
|
195
|
+
|
196
|
+
});
|