第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在輪播滑塊中選擇該類的單個值并將其輸出到活動幻燈片中?

如何在輪播滑塊中選擇該類的單個值并將其輸出到活動幻燈片中?

縹緲止盈 2022-05-14 14:52:21
這是我的代碼行 <script>carousel();function carousel() {    var slider_details = [        {            background: "img/slider/fastfood.jpg",            text1: "What type of",            text2: "Business are you in?",            text3: "We provide best for our client and respect their business design idea.",            text4: "Get Started",            url:   "package_bsd_2+3.html",            id:    "fastfood",        },        {            background: "img/slider/restaurant.jpg",            text1: "What type of",            text2: "Business are you in?",            text3: "We provide best for our client and respect their business design idea.",            text4: "Get Started",            url:   "package_bsd.html",            id:    "restaurant",        },        {            background: "img/slider/beverages.jpg",            text1: "What type of",            text2: "Business are you in?",            text3: "We provide best for our client and respect their business design idea.",            text4: "Get Started",            url:   "packages.html",            id:    "beverages",        },        {            background: "img/slider/cake.jpg",            text1: "What type of",            text2: "Business are you in?",            text3: "We provide best for our client and respect their business design idea.",            text4: "Get Started",            url:   "packages.html",            id:    "cake",        },我想選擇單個類,然后在 alertbox 和 sessionstore 中輸出它“id”,以便在下一頁我可以將它用作圖像的修飾符。我已經(jīng)嘗試過使用類數(shù)組,但問題是它總是在循環(huán)。我需要知道當(dāng)某個 owl-carousel 被選中或激活時,該幻燈片中的 id 將如何被選中。或者,如果您有其他理想的答案,我們也將不勝感激。謝謝!
查看完整描述

2 回答

?
慕碼人8056858

TA貢獻(xiàn)1803條經(jīng)驗 獲得超6個贊

我認(rèn)為您的腳本有錯誤。我修好了請檢查一下。


var slider_details;

var html = "";


 carousel()

function carousel() {

    slider_details = [

        {

            background: "img/slider/fastfood.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd_2+3.html",

            id:    "fastfood",

        },

        {

            background: "img/slider/restaurant.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd.html",

            id:    "restaurant",

        },

        {

            background: "img/slider/beverages.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "packages.html",

            id:    "beverages",

        },

        {

            background: "img/slider/cake.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "packages.html",

            id:    "cake",

        },

        {

            background: "img/slider/fruit.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd.html",

            id:    "fruit",

        },

        {

            background: "img/slider/grocery.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_conv.html",

            id:    "grocery",

        },

        {

            background: "img/slider/flower.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "packages.html",

            id:    "flower",

        },

        {

            background: "img/slider/vegetables.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd.html",

            id:    "vegetables",

        },

        {

            background: "img/slider/organic.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd.html",

            id:    "organic",

        },

        {

            background: "img/slider/office.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd.html",

            id:    "office",

        },

        {

            background: "img/slider/Supermarket.jpg",

            text1: "What type of",

            text2: "Business are you in?",

            text3: "We provide best for our client and respect their business design idea.",

            text4: "Get Started",

            url:   "package_bsd.html",

            id:    "supermarket",

        }

    ];

    

    $.each(slider_details, function(x,y) {


        html += '<div class="text-center item bg-img" data-overlay-dark="7" data-background="'+y.background+'" >';

        html += '    <div class="absolute-middle-center caption">';

        html += '        <div class="overflow-hidden">';

        html += '            <h3 class="alt-font font-size28 sm-font-size18 text-white no-margin">'+y.text1+'</h3>';

        html += '            <h1 class="text-white">'+y.text2+'</h1>';

        html += '            <p class="margin-30px-bottom sm-margin-20px-bottom sm-display-none">'+y.text3+'</p>';

        html += '            <input type="text" class="type" value="'+y.id+'">';

        html += '            <a href="'+y.url+'" class="butn medium theme">';

        html += '                <span class="alt-font">'+y.text4+'</span><i class="fas fa-angle-right font-size16 sm-font-size14 text-white margin-10px-left"></i>';

        html += '            </a>';

        html += '        </div>';

        html += '    </div>';

        html += '</div>';


    });

   

    // sessionStorage.setItem('x', document.getElementById('type').value);


}

$(document).ready(function(){

      $("input").click(function(){

        var value = $(this).val()

            alert(value);

      });

    });


    $('.owl-carousel').html(html);


function testfunc(){

    var g = document.getElementsByClassName("type").value;

    document.getElementById('lblsd').value = g;

}

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="owl-carousel"></div>


查看完整回答
反對 回復(fù) 2022-05-14
?
慕雪6442864

TA貢獻(xiàn)1812條經(jīng)驗 獲得超5個贊

我得到了自己的答案:


在底部添加了這些腳本并修改了 var html


            var html = "";

            $.each(slider_details, function(x,y) {

                html += '<div class="text-center item bg-img" data-overlay-dark="7" data-background="'+y.background+'" >';

                html += '    <div class="absolute-middle-center caption">';

                html += '        <div class="overflow-hidden">';

                html += '            <h3 class="alt-font font-size28 sm-font-size18 text-white no-margin">'+y.text1+'</h3>';

                html += '            <h1 class="text-white">'+y.text2+'</h1>';

                html += '            <p class="margin-30px-bottom sm-margin-20px-bottom sm-display-none">'+y.text3+'</p>';

                // html += '            <input type="text" class="type" value="'+y.id+'">';

                html += '            <a href="'+y.url+'" class="butn medium theme">';

                html += '                <span class="alt-font" id="'+y.id+'" >'+y.text4+'</span><i class="fas fa-angle-right font-size16 sm-font-size14 text-white margin-10px-left"></i>';

                html += '            </a>';

                html += '        </div>';

                html += '    </div>';

                html += '</div>';


            });



<script>

    window.onload = function(){

        sessionStorage.clear();

    }

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=fastfood]").click(function(){

    alert("fastfood");

    sessionStorage.setItem('x', 'fastfood');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=restaurant]").click(function(){

    alert("restaurant");

    sessionStorage.setItem('x', 'restaurant');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=beverages]").click(function(){

    alert("beverages");

    sessionStorage.setItem('x', 'beverages');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=cake]").click(function(){

    alert("cake");

    sessionStorage.setItem('x', 'cake');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=fruit]").click(function(){

    alert("fruit");

    sessionStorage.setItem('x', 'fruit');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=grocery]").click(function(){

    alert("grocery");

    sessionStorage.setItem('x', 'grocery');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=flower]").click(function(){

    alert("flower");

    sessionStorage.setItem('x', 'flower');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=vegetables]").click(function(){

    alert("vegetables");

    sessionStorage.setItem('x', 'vegetables');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=organic]").click(function(){

    alert("organic");

    sessionStorage.setItem('x', 'organic');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=alt-font][id=office]").click(function(){

    alert("office");

    sessionStorage.setItem('x', 'office');

  });

});

</script>

<script>

    $(document).ready(function(){

    $("[class=type][id=supermarket]").click(function(){

    alert("supermarket");

    sessionStorage.setItem('x', 'supermarket');

  });

});

</script>

棘手的舉動,但仍然有效,所以一切都很好。


查看完整回答
反對 回復(fù) 2022-05-14
  • 2 回答
  • 0 關(guān)注
  • 148 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號