亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

重新排列移動屏幕上的多個選擇選項

重新排列移動屏幕上的多個選擇選項

茅侃侃 2023-07-29 15:02:11
我有 4 個選擇選項設置為width: 21%;這在桌面上效果很好,因為它們都是水平對齊的,但在移動設備上保持不變,其中 SELECT 的大小減小,保持水平對齊,并且您無法辨認其中的文本。如何使選擇的選項在桌面上水平對齊,在較小的屏幕上垂直對齊(一個在另一個之上)?我可以更改width: 21%;為width: 260px;但有更好的方法嗎?function filter() {  var filter_num_package = document.getElementById("myInput").value.toUpperCase().trim();  var filter_num_nights = document.getElementById("myInput1").value.toUpperCase().trim();  var filter_num_people = document.getElementById("myInput2").value.toUpperCase().trim();  //loop through tr  $(" tbody tr").each(function() {    //get td value 0,1,2    var first_td = $(this).find("td:eq(0)").text().toUpperCase().trim()    var second_td = $(this).find("td:eq(1)").text().toUpperCase().trim()    var third_td = $(this).find("td:eq(2)").text().toUpperCase().trim()    //check if value matches    if (first_td.includes(filter_num_package) &&      second_td.includes(filter_num_nights) &&      third_td.includes(filter_num_people)) {      //display that row      $(this).css("display", "");    } else {      //hide that row      $(this).css("display", "none");    }  })}function filter1() {  //get value of last select  var values = document.getElementById("myInput3").value.toUpperCase().trim();  //check if value is not both or first option  if (values != "BOTH" && values != "") {    //hide all td which are greater then 4    $("tr").find("td:gt(4)").hide()    //loop through second tr > th    $("table tr:eq(1) th ").each(function() {      //check if the text is equal to selct value      if ($(this).text().toUpperCase().trim() === values) {        //show that th        $(this).show();        //get class 21,22..etc        var class_to_hide = $(this).attr('class');        //check th has value 21,22..etc remove colspan        $("tr").find("th:contains(" + class_to_hide + ")").attr("colspan", "")        //check td which has select option        $("tr td[data-column*=" + $(this).text() + "]").show()      } else {        //hide the th        $(this).hide();      }    })  } 
查看完整描述

1 回答

?
長風秋雁

TA貢獻1757條經驗 獲得超7個贊

你已經快到了,因為你的 jsfiddle 示例中已經有了一個 @media 查詢。您可以覆蓋輸入的寬度,以使它們在較小的屏幕上為全寬。


嘗試將類似的內容添加到 @media 查詢的底部:


@media only screen and (max-width: 760px), 

(min-device-width: 768px) and (max-device-width: 1024px) {

   

    /* add the following below the other styles in the media query: */

    #myInput,

    #myInput1,

    #myInput2,

    #myInput3 {

        width: 100%; /* make the input full width */

        margin-bottom: 5px; /* optional: add some spacing between the vertical inputs */

    }


}


查看完整回答
反對 回復 2023-07-29
  • 1 回答
  • 0 關注
  • 116 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號