123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- $("*").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();
- });
- // gotop下滑效果
- $(".arrow").hide();
- $(window).scroll(function () {
- var y = window.scrollY;
- if (y > 500) {
- $(".arrow").show();
- } else {
- $(".arrow").hide();
- }
- });
- console.log(28);
- // $('.nav-item2').click(function(){
- // $(this).toggleClass('after-nav')
- // })
- $(document).ready(function () {
- $.ajax({
- method: "GET",
- url: "homepageimg.json",
- dataType: "json",
- })
- .done(function (msg) {
- var sec01Content = '';
- console.log(msg);
- var res = msg.length;
- console.log(res);
- const limit = res;
- for (var i = 0; i < limit; i++) {
- var numb = i + 1;
- sec01Content += ' \
- <div class="secimg col-4 col-lg-2 mx-0 px-0"> \
- <img id="' + numb + '" class="img-fluid" src="'+msg[i].srcimg+'" alt="">\
- </div>';
- }
- // $('.sec01-designer').html(sec01Content);
- // var test = msg[0].newstext1;
- // $('#jsontest').append(test);
- });
- });
- // 點選該設計師,導至其對應id的參數網址
- $('#1').click(function () { console.log(1);
- window.location.href =`./about/index.html?id=1`;
- });
- $('#2').click(function () { console.log(2);
- window.location.href =`./about/index.html?id=2`;
- });
-
- $('#3').click(function () { console.log(3);
- window.location.href =`./about/index.html?id=3`;
- });
- $('#4').click(function () { console.log(4);
- window.location.href =`./about/index.html?id=4`;
- });
- $('#5').click(function () { console.log(5);
- window.location.href =`./about/index.html?id=5`;
- });
- $('#6').click(function () { console.log(6);
- window.location.href =`./about/index.html?id=6`;
- });
- $('#7').click(function () { console.log(7);
- window.location.href =`./about/index.html?id=7`;
- });
- $('#8').click(function () { console.log(8);
- window.location.href =`./about/index.html?id=8`;
- });
- $('#9').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=9`;
- });
- $('#10').click(function () { console.log(10);
- window.location.href =`./about/index.html?id=10`;
- });
- $('#11').click(function () { console.log(11);
- window.location.href =`./about/index.html?id=11`;
- });
- $('#12').click(function () { console.log(12);
- window.location.href =`./about/index.html?id=12`;
- });
- $('#13').click(function () { console.log(13);
- window.location.href =`./about/index.html?id=13`;
- });
- $('#14').click(function () { console.log(14);
- window.location.href =`./about/index.html?id=14`;
- });
- $('#15').click(function () { console.log(15);
- window.location.href =`./about/index.html?id=15`;
- });
- $('#16').click(function () { console.log(16);
- window.location.href =`./about/index.html?id=16`;
- });
- $('#17').click(function () { console.log(17);
- window.location.href =`./about/index.html?id=17`;
- });
- $('#18').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=18`;
- });
- $('#19').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=19`;
- });
- $('#20').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=20`;
- });
- $('#21').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=21`;
- });
- $('#22').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=22`;
- });
- $('#23').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=23`;
- });
- $('#24').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=24`;
- });
- $('#25').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=25`;
- });
- $('#26').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=26`;
- });
- $('#27').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=27`;
- });
- $('#28').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=28`;
- });
- $('#29').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=29`;
- });
- $('#30').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=30`;
- });
- $('#30').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=30`;
- });
- $('#31').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=31`;
- });
- $('#32').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=32`;
- });
- $('#33').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=33`;
- });
- $('#34').click(function () { console.log(9);
- window.location.href =`./about/index.html?id=34`;
- });
|