How do you add a scruple?
-
There's a block with a diagram inside of which there's a number. Found the "animateNumber.js" scruple that animates this number from 0 to the number I need. But the violin works right away. How can he only work when I've done it before this block?
Here's the violin:
$('.lines-1') .prop('number', 10) .animateNumber({ number: 90 }, 3700 );
-
I think the code will be enough:
$(document).ready(function(){ $(document).scroll(function(e){ var coord = $(".showMenu").offset(); if ( ($(window).height()+$(window).scrollTop() >= coord.top) && ($(window).scrollTop() - (coord.top + 25) < 0) ){ $('#i_menu').css('display', 'block'); } else { $('#i_menu').css('display', 'none') } }) })
.showMenu{ margin-top:800px; margin-bottom: 800px; border: 1px solid red; } #i_menu{ display:none; background-color:yellow; position:fixed; top:0; width:100%; height:25px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Крути вниз, пацанчик! <br />
<div class="showMenu">Отслеживаемый блок</div>
<div id="i_menu">Я - результат совершаемого действа!!!</div>This is where we track the rabbit. And if the screen height + displacement is greater than the height on which the tracked block is located (margin-top:800px;) or vice versa, the block is too high upwards, do something. In this case, we simply show another block. In your case, it'll be a timer launch.