Commit 9440be68 authored by nursultan's avatar nursultan

bag fix script js

parent d74f8227
......@@ -18,6 +18,8 @@ const benefitsDemoBtn = document.querySelector('.benefits-demo--btn');
const learnMore = document.querySelector('.cc-link');
const videoContainer = document.querySelector('.video-container');
function active() {
nav_hum.classList.toggle('active');
main_nav.classList.toggle('active');
......@@ -155,19 +157,21 @@ function setAttributes(el, attrs) {
Object.keys(attrs).forEach(key => el.setAttribute(key, attrs[key]));
}
document.querySelector('.video-container').addEventListener( 'click', function(e){
e.preventDefault();
document.querySelector('.playbutton').style = "visibility:hidden";
let imgURL = this.querySelector("img").getAttribute('src');
let rx = /\/vi\/([^\/]+)/;
let arr = rx.exec(imgURL);
let url = "//www.youtube.com/embed/"+arr[1]+"?rel=0&autoplay=1";
this.querySelector("img").style = "display: none";
let iframe = document.createElement("iframe");
setAttributes(iframe, {"src": url, "width": "815", "height": "100%", "frameborder" : "0", "allowfullscreen" : "allowfullscreen" });
this.append(iframe);
if (videoContainer) {
videoContainer.addEventListener( 'click', function(e){
e.preventDefault();
document.querySelector('.playbutton').style = "visibility:hidden";
let imgURL = this.querySelector("img").getAttribute('src');
let rx = /\/vi\/([^\/]+)/;
let arr = rx.exec(imgURL);
let url = "//www.youtube.com/embed/"+arr[1]+"?rel=0&autoplay=1";
this.querySelector("img").style = "display: none";
let iframe = document.createElement("iframe");
setAttributes(iframe, {"src": url, "width": "815", "height": "100%", "frameborder" : "0", "allowfullscreen" : "allowfullscreen" });
this.append(iframe);
});
});
}
if (location.hostname === "faceplate.ru"){
document.querySelector(".main-lang").style = "display: none";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment