123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- $(".gototop").hide();
- $(window).scroll(function () {
- var y = window.scrollY;
- if (y > 10) {
- $(".gototop").show();
- } else {
- $(".gototop").hide();
- }
- });
- $("*").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();
- });
- $(".playbutton").click(function () {
- var videosrc = $(this).data("info");
- $('.youtube-video').attr('src', `https://www.youtube.com/embed//${videosrc}?autoplay=1`);
- });
- $(".btn-close").click(function () {
- $('.youtube-video').attr('src', ``);
- });
- $('#yt-video').on('hidden.bs.modal', function () {
- $('.youtube-video').attr('src', ``);
- });
- $(".banner-slide").slick({
- dots: true,
- autoplay: true,
- arrows: false,
- slidesToShow: 1,
- slidesToScroll: 1,
- autoplaySpeed: 7000,
- initialSlide: 0,
- infinite: true,
- });
- $(".violetbeauty_sec01_slide").slick({
- slidesToShow: 4,
- slidesToScroll: 3,
- infinite: true,
- // centerMode: true,
- arrows: true,
- prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: #CC7DB7;transform: translateY(-10px);"></i></button>',
- nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 32px;color: #CC7DB7;transform: translateY(-10px);"></i></button>'
- });
- $(".violetbeauty_sec02_slide").slick({
- slidesToShow: 3,
- slidesToScroll: 3,
- infinite: true,
- // centerMode: true,
- arrows: true,
- prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: #CC7DB7;transform: translateY(-10px);"></i></button>',
- nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 32px;color: #CC7DB7;transform: translateY(-10px);"></i></button>'
- });
- $(".learn_more").click(function () {
- var courseid = $(this).data("info");
- // console.log(courseid);
- $.ajax({
- method: "GET",
- url: "coursecontent.json",
- dataType: "json",
- })
- .done(function (msg) {
- // console.log(msg)
- for (var i = 0; i < msg.length; i++) {
- if (msg[i].Courseid == courseid) {
- var CourseContent = '';
- console.log(msg[i]);
- CourseContent = `
- <div class="course_detail py-3">
- <div class="row">
- <div class="col-md-7">
- <div class="course_detail_img mt-3">
- <img class="img-fluid" src="${msg[i].CourseImg}" alt="">
- </div>
- </div>
- <div class="col-md-5">
- <div class="course_detail_text">
- <div class="features_title fw-bold text-start">${msg[i].CourseTitle}</div>
- <div class="sec_content_right_text">
- <p>${msg[i].Coursetext}</p>
- </div>
- </div>
- <div class="text-center">
- <button class="violetbeauty_CTA mt-4"><a style="text-decoration: none;"
- target="_blank" href="https://line.me/R/ti/p/%2540qlo9716l"><img
- class="cta_flower" src="./img/flower.png" alt="">立即體驗</a></button>
- </div>
- </div>
- </div>
- </div>
- `
- }
- $('.modal-body').html(CourseContent);
- }
- });
- });
- // facial.html
- $.ajax({
- type: "GET",
- url: "facial.json",
- dataType: "json",
- success: function (res) {
- let facialList = [];
- let facialModalList = [];
- for (let i = 0; i < res.length; i++) {
- let facialCardContent = `
- <div class="col-12 col-md-6 col-lg-4">
- <div class="card h-100">
- <div class="img-box">
- <img src="./img/violetbeauty/karelys-ruiz-PqyzuzFiQfY-unsplash.png" class="card-img-top" alt="...">
- </div>
- <div class="card-body">
- <div class="d-flex justify-content-between">
- <h5 class="badge">臉部課程</h5>
- <div class="d-flex align-items-center time-box">
- <img src="./img/icon-time.png" alt="">
- <p><span>${res[i].time}</span>分鐘</p>
- </div>
- </div>
- <h5 class="card-title fw-bold my-3">${res[i].title}</h5>
- <p class="card-text">${res[i].description}</p>
- </div>
- <button type="button" class="btn" data-bs-toggle="modal" data-bs-target="#facial_modal_${i + 1}">
- 了解課程
- </button>
- </div>
- </div>`;
- let facialModalContent = `
- <div class="modal fade" id="facial_modal_${i + 1}" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered modal-xl">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body m-3 m-xl-5 mb-2 mb-lg-5">
- <div class="container-fluid">
- <div class="row align-items-center">
- <div class="col-12 col-lg-7">
- <img src="./img/violetbeauty/sec00.jpg" alt="" style="width: 100%;">
- </div>
- <div class="col-12 col-lg-5 px-3 px-xl-5">
- <h5 class="fw-bold my-3">${res[i].title}</h5>
- <div class="d-flex justify-content-between my-4">
- <div class="d-flex flex-column price-box">
- <span>體驗價 $${res[i].price}</span>
- <span>原價 $${res[i].originalPrice}</span>
- </div>
- <div class="d-flex align-items-center time-box">
- <img src="./img/icon-time.png" alt="">
- <p><span>${res[i].time}</span>分鐘</p>
- </div>
- </div>
- <section class="d-flex flex-column justify-content-between">
- <p>${res[i].description}</p>
- <div class="recommend-item">
- <span class="badge">推薦</span>
- ${res[i].recommend}
- </div>
- </section>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>`;
- facialList.push(facialCardContent);
- facialModalList.push(facialModalContent);
- $('.facial-content-item').html(facialList);
- $('.facial-modal').html(facialModalList);
- }
- },
- error: function (err) {
- console.log('err', err);
- }
- });
- // massage.html
- $.ajax({
- type: "GET",
- url: "massage.json",
- dataType: "json",
- success: (res) => {
- let massageList = [];
- let massageModalList = [];
- let contentList = [
- `<div class="col-12 col-md-6 col-xl-4">
- <div class="card h-100">
- <div class="img-box">
- <img src="./img/violetbeauty/karelys-ruiz-PqyzuzFiQfY-unsplash.png" class="card-img-top" alt="...">
- </div>
- <div class="card-body">
- <div class="d-flex justify-content-between">
- <h5 class="badge">身體課程</h5>
- <div class="d-flex align-items-center time-box">
- <img src="./img/icon-time.png" alt="">
- <p><span>60</span>分鐘/<span>120</span>分鐘</p>
- </div>
- </div>
- <h5 class="card-title fw-bold my-3">波動舒活經絡課程</h5>
- <p class="card-text">久坐、久站或長期的姿勢不良,讓妳經常腰酸背痛嗎?手技搭配儀器,不再是單純肌肉放鬆,針對氣血循環,功力深厚的技巧,專業的儀器走向,完全放鬆你的身心靈。</p>
- </div>
- <button type="button" class="btn" data-bs-toggle="modal" data-bs-target="#massageModal_1">
- 了解課程
- </button>
- </div>
- </div>`,
- `<div class="col-12 col-md-6 col-xl-4">
- <div class="card h-100">
- <div class="img-box">
- <img src="./img/violetbeauty/karelys-ruiz-PqyzuzFiQfY-unsplash.png" class="card-img-top" alt="...">
- </div>
- <div class="card-body">
- <div class="d-flex justify-content-between">
- <h5 class="badge">身體課程</h5>
- <div class="d-flex align-items-center time-box">
- <img src="./img/icon-time.png" alt="">
- <p><span>40</span>分鐘/<span>60</span>分鐘/<span>80</span>分鐘</p>
- </div>
- </div>
- <h5 class="card-title fw-bold my-3">五行氣穴課程</h5>
- <p class="card-text">藉由中醫理論五行學說,透過美容師手勁與技巧將阻塞處舒展,達到通筋通便活絡氣血效應,達到陰陽流暢,全程手技,使用原始原點精油,刺激身體各部位穴點,與一般經絡按摩較不同!愛按摩的你絕不能錯過。</p>
- </div>
- <button type="button" class="btn" data-bs-toggle="modal" data-bs-target="#massageModal_2">
- 了解課程
- </button>
- </div>
- </div>`,
- `<div class="col-12 col-md-6 col-xl-4">
- <div class="card h-100">
- <div class="img-box">
- <img src="./img/violetbeauty/karelys-ruiz-PqyzuzFiQfY-unsplash.png" class="card-img-top" alt="...">
- </div>
- <div class="card-body">
- <h5 class="badge">身體課程</h5>
- <h5 class="card-title fw-bold my-3">半永久熱蠟除毛</h5>
- <p class="card-text">擾人的毛髮交給我們,容易悶熱滋生細菌造成異味,妳的救星!熱蠟是所有技術中最低疼痛感,能讓毛髮生長延緩,達到重生毛髮越來越細軟,甚至無毛。</p>
- </div>
- <button type="button" class="btn" data-bs-toggle="modal" data-bs-target="#massageModal_3">
- 了解課程
- </button>
- </div>
- </div>`];
- for (let i = 0; i < res.length; i++) {
- let massageCardContent = `
- <div class="col-12 col-md-6 col-xl-4">
- <div class="card h-100">
- <div class="img-box">
- <img src="./img/violetbeauty/karelys-ruiz-PqyzuzFiQfY-unsplash.png" class="card-img-top" alt="...">
- </div>
- <div class="card-body">
- <div class="d-flex justify-content-between">
- <h5 class="badge">身體課程</h5>
- <div class="d-flex align-items-center time-box">
- <img src="./img/icon-time.png" alt="">
- <p><span>${res[i].time}</span>分鐘</p>
- </div>
- </div>
- <h5 class="card-title fw-bold my-3">${res[i].title}</h5>
- <p class="card-text">${res[i].description}</p>
- </div>
- <button type="button" class="btn" data-bs-toggle="modal" data-bs-target="#massage_modal_${i + 1}">
- 了解課程
- </button>
- </div>
- </div>`;
- let massageModalContent = `
- <div class="modal fade" id="massage_modal_${i + 1}" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered modal-xl">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <div class="modal-body m-3 mb-2 mb-lg-5">
- <div class="container-fluid">
- <div class="row align-items-center">
- <div class="col-12 col-lg-7">
- <img src="./img/violetbeauty/sec00.jpg" alt="" style="width: 100%;">
- </div>
- <div class="col-12 col-lg-5 px-3 px-xl-5">
- <h5 class="fw-bold my-3">${res[i].title}</h5>
- <div class="d-flex justify-content-between my-4">
- <div class="d-flex flex-column price-box">
- <span>體驗價 $${res[i].price}</span>
- <span>原價 $${res[i].originalPrice}</span>
- </div>
- <div class="d-flex align-items-center time-box">
- <img src="./img/icon-time.png" alt="">
- <p><span>${res[i].time}</span>分鐘</p>
- </div>
- </div>
- <section class="d-flex flex-column justify-content-between">
- <p>${res[i].description}</p>
- <div class="recommend-item">
- <span class="badge">推薦</span>
- ${res[i].recommend}
- </div>
- </section>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>`;
- massageList.push(massageCardContent);
- massageModalList.push(massageModalContent);
- // 合併陣列
- const massageArray = contentList.concat(massageList);
- $('.massage-content-item').html(massageArray);
- $('.massage-modal').html(massageModalList);
- }
- },
- error: function (err) {
- console.log('err', err);
- }
- });
|