Каталог файловtilda-t136.js
201SequenceController.prototype.getItemHeight = function (el) {202 var txtBlock = el.querySelector("[data-hook='item-text']");203 var computedTop = parseFloat(getComputedStyle(txtBlock).top);204 txtBlock.style.top = computedTop + 'px';205 var totalHeight = Math.max(txtBlock.clientHeight + computedTop, this.itemHeight);206 return totalHeight;207};208 209SequenceController.prototype.fixTextBlocksPosition = function (node) {210 var txtBlocks = Array.prototype.slice.call(node.querySelectorAll('[data-hook="item-text"]'), 0);211 txtBlocks.forEach(function (el) {
История файла и сравнение версий
var backgroundSibling = el.parentNode.querySelector("[data-hook='item-background']");
213 backgroundSibling.style.top = '-' + el.clientHeight + 'px'; 217SequenceController.prototype.unergisterBlock = function (node) { 218 for (var i = 0, l = this.sequenceObjects.length, index = null; i < l; i++) { 219 if (this.sequenceObjects[i].sequenceBlock === node) { 224 if (index !== null) { 225 this.sequenceObjects.splice(index, 1); 231 * @param {HTMLElement} el 232 * @returns {Number|number} 234SequenceController.prototype.getAbsoluteTopOffset = function (el) { 235 var topOffset = el.offsetTop; 236 el = el.offsetParent; 238 topOffset += el.offsetTop; 239 el = el.offsetParent; 244 * @param {Boolean} direction 245 * 1 - from top to bottom 246 * 0 - from bottom to top 248SequenceController.prototype.processSequence = function (sequenceObject) { 249 if (sequenceObject.started == false) { 250 sequenceObject.prevBackgroundColor = document.body.style.backgroundColor; 251 document.body.style.backgroundColor = 'rgb(0, 0, 0)'; 252 sequenceObject.started = true; 255 var sequenceItems = sequenceObject.items; 256 var currentItemIndex = null; 258 var backgroundHolderStyle; 261 for (var i = 0, l = sequenceItems.length, nodeRect; i < l; i++) { 262 node = sequenceItems[i].node; 263 nodeRect = node.getBoundingClientRect(); 266 nodeRect.top < this.itemTransitionTop && 267 nodeRect.bottom < nodeRect.height + this.itemTransitionTop && 268 nodeRect.bottom > this.itemTransitionTop 270 currentItemIndex = i; 275 if (currentItemIndex == null) { 278 opacity = nodeRect.top / this.itemTransitionTop; 281 } else if (opacity < 0) { 285 for (var i = 0, l = sequenceItems.length; i < l; i++) { 286 (node = sequenceItems[i].node), (backgroundHolderStyle = sequenceItems[i].backgroundHolder.style); 287 if (backgroundHolderStyle.position != 'fixed') { 288 backgroundHolderStyle.position = 'fixed'; 290 if (i == currentItemIndex) { 291 /* transitted already */ 292 backgroundHolderStyle.opacity = 1 - opacity; 293 node.querySelector('.txt-holder').style.opacity = 1 - opacity; 294 } else if (i == currentItemIndex - 1) { 295 backgroundHolderStyle.opacity = opacity; 296 node.querySelector('.txt-holder').style.opacity = opacity; 298 backgroundHolderStyle.opacity = 0; 299 node.querySelector('.txt-holder').style.opacity = 0;