var counter = 0,
divs = document.getElementsByTagName("div"),
linksNumber = divs.length,
delay = 10000;
function openLink () {
var url = divs[counter].innerHTML;
window.open(url);
if (counter < length) {
counter++;
setTimeout(openLink, delay);
}
}
setTimeout(openLink, delay);
var data = JSON.parse('[{"ui_bid":"1451245124","ui_id":"124161616"},{"ui_bid":"124124124","ui_id":"123124"},{"ui_bid":"0","ui_id":"12123124"},{"ui_bid":"0","ui_id":"1231242352"}]');
data.forEach(function (item, value) {
var bid = +item.ui_bid;
if (bid) {
console.log(value); // Вот тут ваш запрос
}
});
var names = ["Stavka-1", "Stavka-2", "Stavka-3"];
ion.sound({
sounds: [
{name: names[0]},
{name: names[1]},
{name: names[2]}
],
volume: 1,
path: "/sounds/",
preload: true
});
var rand = Math.round(Math.random() * (names.length - 1));
ion.sound.play(names[rand]);
while
тут не нужен. Нужно сделать так: jsfiddle.net/7m6waxLmvar hlt1 = 10,
hlt2 = 10;
function change() {
hlt1 -= 1;
hlt2 -= 1;
var inProgress = hlt1 > 0 && hlt2 > 0;
console.log(hlt1, hlt2, inProgress);
if (inProgress) {
setTimeout(change, 1000);
}
}
setTimeout(change, 1000);
<div class="fixed hidden">
Фиксированный блок
</div>
.fixed {
position: fixed;
bottom: 30px;
right: 30px;
width: 100px;
height: 50px;
background: #000;
}
.fixed.hidden {
display: none;
}
var $win = $(window),
$fixed = $(".fixed"),
limit = 300;
function tgl (state) {
$fixed.toggleClass("hidden", state);
}
$win.on("scroll", function () {
var top = $win.scrollTop();
if (top < limit) {
tgl(true);
} else {
tgl(false);
}
});