// Пример с плагинов https://github.com/camwiegert/in-view
// Строки 10 - 14 в примере выше
inView('.newComment')
.on('enter', function(){
setTimeout(function() {
newComment.classList.remove('new');
}, 3000);
})
});
first.addEventListener('change', function(e) {
....
});
first.addEventListener('change', function(e) {
// this.value - значение первого select'а
second.querySelector('option[value=' + this.value + ']').selected = 'selected'
});
chrome.downloads.download({url:url,filename:filename,saveAs: false},function() {
console.log(chrome.runtime.lastError);
});
console.log(li, "li"); // array of elements "li"
for (var i = li.length - 1; i >= 0; i--) {
console.log(li[i], "li[i]"); // element with sequence number "i" in array "li"
console.log(li[i].getElementsByTagName('a'), "li[i].getElementsByTagName('a')"); // all <a> - elements in li[i]
console.log(li[i].getElementsByTagName('a')[0], "li[i].getElementsByTagName('a')[0]"); // first <a> - element in li[i]
let a = li[i].getElementsByTagName('a')[0];
}
const images = document.querySelectorAll('img');
images.forEach(function(img){
// get image width: 'w' and height: 'h'
// get list-product-item__img width: containerW, height: containerH
// .....
const imgAspect = w/h;
const containerAspect = containerW/containerH;
if (containerAspect>imgAspect) {
// set image width and height
img.style.width = containerW;
img.style.height = containerW / imgAspect;
} else {
// set image width and height
img.style.height = containerH;
img.style.width = containerH * imgAspect;
}
})
.image{
/* ваши стили */
/* сдвигаем на 100px вниз и задаем прозрачность 0*/
transform: translate3d(0, 100px, 0);
opacity: 0;
/* ******* */
transition: opacity .3s, transform .3s;
}
.image.is-shown{
/* возвращаем в обычное состояние */
transform: translate3d(0, 0px, 0);
opacity: 1;
}
const image = document.getElementById('image');
const imageFromTop = image.getBoundingClientRect().top;
const showOnScroll = debounce(function() {
// How much scroll from top
let scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
// Check scroll position
if (imageFromTop < scrollTop + 500) {
image.classList.add('is-shown')
// Remove this listener for better pref
window.removeEventListener('scroll', showOnScroll, false);
}
}, 30);
window.addEventListener('scroll', showOnScroll, false);
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
.cv-image {
position: relative
}
.img1,
.img2 {
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%)
}
const el = document.getElementById('image');
const divOffset = offset(el);
window.onscroll = stay;
function stay() {
var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
el.style.top = divOffset.top + scrollTop + 'px'
}
function offset(el) {
var rect = el.getBoundingClientRect(),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
}
sudo apt install screen
screen -S mybot
python3 bot.py
screen -r mybot
- чтобы открыть при следующем входе pip install pipenv
sudo apt install software-properties-common python-software-properties
sudo add-apt-repository ppa:pypa/ppa
sudo apt update
sudo apt install pipenv
sudo apt install python3-pip
sudo apt install python-pip
pip install --help
--user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on
Windows. (See the Python documentation for site.USER_BASE for full details.)
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install python3
sudo apt-get install -y python3-pip
pip3 install virtualenv
mkdir django-apps
cd django-apps
virtualenv env
. env/bin/activate
(env) sammy@ubuntu:$ pip install django
(env) sammy@ubuntu:$ django-admin --version
(env) sammy@ubuntu:$ django-admin startproject app
h = document.getElementById('A').clientHeight ||
h = document.getElementById('A').offsetHeight ||
h = document.getElementById('A').scrollHeight ||
t = window.pageYOffset