
/* 插入JS套件
========================================================*/
function include(scriptUrl) {
    document.write('<script src="' + scriptUrl + '"></script>');
}

/* 下拉選單select設定
========================================================*/
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}	


/* RD Navbar 主選單設定
========================================================*/
(function ($) {
    var o = $('.rd-navbar');
    if (o.length > 0) {
        include('/assets/js/rd-navbar/jquery.rd-navbar.js');

        $(document).ready(function () {
            o.RDNavbar({
                stickUpClone: false,
                stickUpOffset: 170
            });
        });
    }
})(jQuery);


/* 各套件設定
========================================================*/
$(function(){

	//置頂設定
	$.scrollUp();
	
    //圖片延遲效果設定
    $("img.lazyload").lazyload();
    
	// 次選單滑動效果
	$('a[href*="#anchor"]:not([href="#anchor"])').click(function () {
		if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') ||
			location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
			if (target.length) {
				$('html,body').animate({
					scrollTop: target.offset().top - 120
				}, 1000);
				return false;
			}
		}
	});

    //wow動畫
    AOS.init();
    
    
    //文字動畫
//    $('.bannerText1').textillate({
//        in: {
//            effect: 'fadeInUp',
//            delay: 0,
//        }
//    });
//    $('.bannerText2').textillate({
//        initialDelay : 600,
//        in: {
//            effect: 'fadeInDown',
//            delay: 30,
//        }
//    });
	
	// 產品選單下拉設定
//	$("#red").treeview({
//		animated: "fast",
//		collapsed: true,
//		unique: true,
//		persist: "cookie",
//		toggle: function() {
//			window.console && console.log("%o was toggled", this);
//		}
//	});
});


