$(function(){
/* scroll */
var $animation_elements = $('.ani');
var $window = $(window);
function check_if_in_view() {
var window_height = $window.height();
var window_top_position = $window.scrollTop();
var window_bottom_position = (window_top_position + window_height);
$.each($animation_elements, function() {
var $element = $(this);
var element_height = $element.outerHeight();
var element_top_position = $element.offset().top+200;
var element_bottom_position = (element_top_position + element_height);
//console.log(element_top_position);
//check to see if this current container is within viewport
if ((element_bottom_position >= window_top_position) &&
(element_top_position <= window_bottom_position)) {
$element.addClass('in-view');
} else {
//$element.removeClass('in-view');
}
});
}
$window.on('scroll resize', check_if_in_view);
$window.trigger('scroll');
/* main bx Slide */
$(window).load(function(){
var slider = $(".bxslide").bxSlider({
mode: 'fade', //슬라이드 동작모드 :'horizontal', 'vertical', 'fade'
pause:5000, //멈춤 대기시간
speed: 2000, // 이동 속도를 설정
auto: true, // 자동 실행 여부
infiniteLoop: true, //무한루프설정
controls: true, // 이전 다음 버튼 노출 여부
pager: false,
prevSelector: '#prevBtn',
nextSelector: '#nextBtn',
prevText: "",
nextText: "",
//슬라이더 콜백 함수 (기본 옵션)
//버튼 눌렀을때 멈추는 현상을 다시 실행시킴
onSlideAfter: function() {
slider.stopAuto();
slider.startAuto();
}
});
});
//이동
$(".main_scroll_btn img").click(function(){
$('html,body').stop().animate({scrollTop:$('.section01').offset().top}, 600);
})
});