Skip to content

Commit

Permalink
Optimizer Total Blocking Time
Browse files Browse the repository at this point in the history
  • Loading branch information
alothemes committed Feb 2, 2021
1 parent b4cfcea commit c0cabb0
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions view/base/web/js/grid-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: Alex Dong
* @Date: 2020-07-29 13:21:07
* @Last Modified by: Alex Dong
* @Last Modified time: 2020-08-27 22:40:56
* @Last Modified time: 2021-02-02 19:35:42
*/

define([
Expand All @@ -17,7 +17,25 @@ define([
},

_create: function () {
this._initSlider();
var options = this.options;
var self = this;
if ("IntersectionObserver" in window) {
let gridSliderObserver = new IntersectionObserver(function(entries, observer) {
entries.forEach(function(entry) {
if (entry.isIntersecting) {
// let el = entry.target;
self._initSlider();
gridSliderObserver.unobserve(entry.target);
}
});
});

self.element.each(function(index, el){
gridSliderObserver.observe(el);
});
} else {
self._initSlider();
}
},

_uniqid: function (a = "", b = false) {
Expand Down Expand Up @@ -61,6 +79,7 @@ define([
});
}
el.on('init', function(event, slick){
$('body').trigger('contentUpdated'); // support lazyload
var video = $(this).find('.external-video');
video.click(function(event) {
var $this = $(this);
Expand Down

0 comments on commit c0cabb0

Please sign in to comment.