.header
height 60px
background #000
&--fixed
position fixed
left 0
top 0
$(window).scroll(function() {
var container = $('.header');
var status = $(this).offsetTop >= container.height() ? true : false;
container.toggleClass('.header--fixed', status);
});
<div class="example">
<div class="operate"></div>
<div class="line_one"></div>
<div class="line_two"></div>
<div class="result"></div>
</div>
.example {
position: relative;
width: 50px;
height: 200px;
text-align: right;
}
.example .operate {
position: absolute;
left: 0;
top: 10px;
}
.example .line_two {
border-bottom: 1px solid #000;
}
calculator(246, 154, '+');
function calculator(one, two, operate) {
var container = $('.example');
container.find('.operate').text(operate);
container.find('.line_one').text(one);
container.find('.line_two').text(two);
container.find('.result').text(eval(one + operate + two));
}
<IfModule mod_headers.c>
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
</IfModule>