123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
-
- // 手機板menu彈跳視窗
- $("#menu-box2").hide();
- $("#menu-box").hide();
- $(".link").click(function () {
- $("#menu-box").fadeOut("slow", function () {
- $("#menu-box2").fadeOut("slow");
- // Animation complete.
- });
- });
- $("#menu-btn1").click(function () {
- $("#menu-box").fadeIn();
- $("#menu-box2").fadeIn();
- });
- $(".close").click(function () {
- $("#menu-box").fadeOut();
- $("#menu-box2").fadeOut();
- });
- // sec01 最新課程手機輪播
- $('#sec01-moblie-container').slick({
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- infinite: false,
- centerMode: true,
- });
- $('#sec01-slider-next').click(function () {
- $('#sec01-moblie-container').slick('slickNext')
- });
-
- // sec04 專欄報導 手機輪播
- $('#sec04-moblie-container').slick({
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- infinite: false,
- centerMode: true,
- });
- $('#sec04-slider-next').click(function () {
- $('#sec04-moblie-container').slick('slickNext')
- });
- // sec03排名table輪播
- $('#sec03-slider').slick({
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- infinite: true,
- });
-
- $('#sec03-slider-next').click(function () {
- $('#sec03-slider').slick('slickNext')
- });
-
- $("*").each(function (index, element) {
- // 此元素被點選後執行
- $(this).click(function (e) {
- // 取得被點選元素的屬性:data-gt-target
- var target = $(this).attr("data-gt-target");
- var duration = $(this).attr("data-gt-duration");
- var offset = $(this).attr("data-gt-offset");
-
- // JS 語法:判斷式
- // if (條件) {程式區塊}
- // 當條件成立,會執行程式區塊
-
- // 如果 目標有資料 才會執行 { } 內的程式
- // 避免出現 undefine (未定義 - 不存在的資料)
- if (target) {
- //console.log("目標:" + target);
- //console.log("時間:" + duration);
- //console.log("位移:" + offset);
-
- // 上方位置 = 目標區塊.位移().上方位置
- var top = $(target).offset().top;
- //console.log("要前往元素的上方位置:" + top);
-
- // 網頁元素.停止().動畫({ 上方捲動:指定元素 - 位移},持續時間)
- // parseInt() 將文字轉為數字
-
- $("html").stop().animate({
- scrollTop: top - offset
- }, parseInt(duration));
- }
- });
- });
-
- // 避免動畫與使用者滾輪衝突
- // html 在滾動滾輪時 停止 html 所有效果
- $("html").on("mousewheel", function () {
- $("html").stop();
- });
-
|