var CACHE_VERSION = "v1";
var CACHE_NAME = CACHE_VERSION + ":sw-cache-";
var filesToCache = [
'/index.php',
'/templates/new/css/0jquery-ui.css',
'/templates/new/css/1bootstrap.css'
];
self.addEventListener('install', function(e) {
console.log('[ServiceWorker] Install');
e.waitUntil(
caches.open(CACHE_NAME).then(function(cache) {
console.log('[ServiceWorker] Caching app shell');
return cache.addAll(filesToCache);
})
);
});
self.addEventListener('activate', function(e) {
console.log('[ServiceWorker] Activate');
e.waitUntil(
caches.keys().then(function(keyList) {
return Promise.all(keyList.map(function(key) {
if (key !== CACHE_NAME) {
console.log('[ServiceWorker] Removing old cache', key);
return caches.delete(key);
}
}));
})
);
return self.clients.claim();
});
const select = document.getElementById("select");
select.addEventListener("change", function(e) {
console.log("value", e.target.value);
});
var option = {
scale: 1.2
};
var option = {
transform: ["scale(1.2)", "scale(1)"]
};
.active:hover {
background: none; // свойства отменяющие hover без класса active
}
new Swiper('.swiper-container', {
speed: 400,
spaceBetween: 100
});
var mySwiper = document.querySelector('.swiper-container').swiper
mySwiper.appendSlide('<div class="swiper-slide">Slide 10"</div>')
mySwiper.appendSlide([
'<div class="swiper-slide">Slide 10"</div>',
'<div class="swiper-slide">Slide 11"</div>'
]);
class SomeClass {
// ...
}
window.__SomeClass = SomeClass;
new window.__SomeClass()
let animateId;
// ...
animateId = requestAnimationFrame(timeBetweenDates);
function timeBetweenDates() {
//...
animateId = requestAnimationFrame(timeBetweenDates);
}
$('.restart').click(function() {
//...
cancelAnimationFrame(animateId)
//...
});
if (window) {
// код, который выполнится только в браузере
} else {
// код, который выполнится только на сервере
}
<MobileMenu onClose={this.toggleMenuHandler}/>