if ($(window).width() < 769) {
$(window).scroll(function() {
var top = $(document).scrollTop();
if (top < 1) $('.topblock').css({'box-shadow':'none','background':'rgba(255,255,255,0.0)'});
else $('.topblock').css({'box-shadow':'0 0 2px rgba(0,0,0,0.5)','background':'rgba(255,255,255,0.9)'});
});
} else {
//do another
}
$(window).on('resize', (function() {
if ($(window).width() < 769) {
$(window).scroll(function() {
var top = $(document).scrollTop();
if (top < 1) $('.topblock').css({'box-shadow':'none','background':'rgba(255,255,255,0.0)'});
else $('.topblock').css({'box-shadow':'0 0 2px rgba(0,0,0,0.5)','background':'rgba(255,255,255,0.9)'});
});
} else {
//do another
}
}));
<script>
function toggleFunc(){
let el = this;
return [
function() {
console.log('первый клик');
},
function() {
console.log('второй клик');
}
][el.tog^=1]();
}
$("button").click( toggleFunc );
</script>
<script>
$("button").toggle(
function () {
console.log('первый клик');
},
function () {
console.log('второй клик');
},
function () {
console.log('можно и третий');
},
);
</script>
<div id="video0"></div>
<div id="video1"></div>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player = [];
function onYouTubeIframeAPIReady() {
player[0] = new YT.Player('video0', {
height: '360',
width: '640',
videoId: 'id_video0',
});
player[1] = new YT.Player('video1', {
height: '360',
width: '640',
videoId: 'id_video1',
});
}