twitter-bootstrap 相关问题

Bootstrap是一个前端框架,旨在启动Web应用程序和站点的开发。有关Bootstrap版本的问题,请使用“twitter-bootstrap-2”,“twitter-bootstrap-3”和“bootstrap-4”标签中的特定版本标签。

导航栏改变颜色javascript无法正常工作

和其他人一样,我在向下滚动时尝试修改导航栏。我读到了这个问题:滚动后更改导航栏颜色? Scroll Down Bootstrap导航栏将颜色更改为...时Navbar中的过渡

回答 2 投票 0

在bootstrap模式中显示视频js视频的问题

模态显示正确,但当我点击模态。视频和视频控制混乱了。如果我做错了,请建议是否有任何其他合适的方式。我有一个很好的图书馆......

回答 1 投票 0

Bootstrap DateRangePicker日历和右/左图标不显示

我正在使用Bootstrap Date Range Picker,在此我无法获得Calendar和Left / Right Arrow glyphicon。下面是我实施的代码。

回答 2 投票 0

Bootstrap元素100%宽度

我想创建交替的100%彩色块。 “理想”情况被说明为附件以及当前情况。期望的设置:目前:我的第一个想法是创建一个......

回答 11 投票 68

form-inline类的bootstrap 4在IE和Edge中显示两行控件

我使用bootstrap 4在html中使用了以下标记,它在单行中显示,而在IE Edge中它被分成两个

回答 1 投票 -1

select2 MULTIPLE 占位符不起作用

我正在使用以下代码来选择项目,但占位符已经不可见。我正在使用这个例子 select2-bootstrap 我正在使用以下代码来选择项目,但占位符已经不可见。我正在使用这个例子select2-bootstrap <div class="form-group" style="width:70px; height:44px;"> <select class="form-control select2" multiple="multiple" id="select2" placeholder="cawky parky"> <option>ahoj</option> <option>more</option> <option>ideme</option> <option>na </option> <option>pivo?</option> </select> </div> <script src="//select2.github.io/select2/select2-3.4.2/select2.js"></script> $(document).ready(function () { $("#select2").select2({ multiple:true, placeholder: "haha", }); 2020解决方案 这里的大问题是您选择的第一个选项 + 您的占位符太大而无法放入下拉列表中。因此,select2 将强制占位符为 width:0;. 这可以通过以下两行 CSS 来解决,这将覆盖此 select2“功能”: .select2-search--inline { display: contents; /*this will make the container disappear, making the child the one who sets the width of the element*/ } .select2-search__field:placeholder-shown { width: 100% !important; /*makes the placeholder to be 100% of the width while there are no options selected*/ } 注意:placeholder-shown 伪类在某些浏览器的最旧版本以及 IE 上不起作用,因为您可以在here. 经过数小时的尝试,我注意到最初呈现选择时,.select2-search__field 的宽度为 0px。当我选择一个选项然后删除该选项时,显示占位符并且宽度约为 1000px。 所以为了解决这个问题,我做了以下事情: $('.search-select-multiple').select2({ dropdownAutoWidth: true, multiple: true, width: '100%', height: '30px', placeholder: "Select", allowClear: true }); $('.select2-search__field').css('width', '100%'); 在您的脚本文件中添加: $('select').select2({ minimumResultsForSearch: -1, placeholder: function(){ $(this).data('placeholder'); } }): 在 HTML 中添加: <select data-placeholder="Yours Placeholder" multiple> <option>Value 1</option> <option>Value 2</option> <option>Value 3</option> <option>Value 4</option> <option>Value 5</option> </select> 只需使用数据占位符而不是占位符。 <div class="form-group" style="width:70px; height:44px;"> <select class="form-control select2" multiple="multiple" id="select2" data-placeholder="cawky parky"> <option>ahoj</option> <option>more</option> <option>ideme</option> <option>na </option> <option>pivo?</option> </select> </div> 对我来说,占位符似乎需要allowClear: true和对象模式。尝试以下操作,看看它是否有效。有关使用 yadcf 的一般示例,请参见https://codepen.io/louking/pen/BGMvRP?#(抱歉,额外的复杂性,但我相信 yadcf 将 select_type_options 直接传递给 select2)。 $("#select2").select2({ multiple:true, allowClear:true, placeholder: { id: -1 text: "haha" } }); 在你的脚本文件中: $("select").each(function(i,v){ var that = $(this); var placeholder = $(that).attr("data-placeholder"); $(that).select2({ placeholder:placeholder }); }); 在您的 html 中(添加数据占位符 =“您的文本”): <select data-placeholder="Yours Placeholder" multiple> <option>Value A</option> <option>Value B</option> </select> 这是 select2 GitHub 上的 已解决问题 但它从未在库本身中真正解决过。 我的解决方案类似于 Pedro Figueiredo 提出的 solution,除了它不会使容器消失。有一个关于display: contents的note,这可能会导致一些可访问性问题。您也可以简单地将其切换为 100% 宽度: .select2-search--inline, .select2-search__field:placeholder-shown { width: 100% !important; } 我更喜欢并发现基于 .select2-container 设置样式稍微更简洁,这样我就可以调用标准的 HTML 元素,如下所示: .select2-container li:only-child, .select2-container input:placeholder-shown { width: 100% !important; } 任何一组代码都以任何一种方式访问相同的元素,我不确定哪一个更“未来证明”;现在这是一个偏好问题。 此外,如果您使用的是标签,则可能需要添加一个 .select2-container { width: 100% !important; } 否则在切换到默认情况下不显示的选项卡时,select2 字段的宽度可能不正确。 在你的 html 中 <select class="form-control select2" multiple="multiple" id="select2"> <option selected="selected">cawky parky</option> <option>ahoj</option> <option>more</option> <option>ideme</option> <option>na </option> <option>pivo?</option> </select> 在你的 jquery 中 $(".select2").select2({ placeholder: "Selecione", allowClear: true }); 我找到了另一种方法,当我将 select2 附加到 dom 时 $('.select2-search__field').width('100%') 用它改变宽度样式 $('.select2-search__field').width('100%') function setSelect(select, data, placeholder) { select.each(function () { let $this = $(this) $this.wrap('<div class="position-relative"></div>') $this.select2({ placeholder, allowClear: true, dropdownParent: $this.parent(), dropdownAutoWidth: true, data }) }) $('.select2-search__field').width('100%') } 选择2/3.5.4 在你的 CSS 中: .select2-search-field, .select2-search-field input[placeholder] { width: 100% !important; } Select2 4.0.1 仍然不适用于我的多项选择。 我的解决方案 HTML <select class="select-2" multiple> ... </select> JS $('.select-2').select2({ minimumResultsForSearch: -1, placeholder: function(){ $(this).data('placeholder'); } }); $('.select-2[multiple]').each(function() { $(this).next('.select2').find('textarea').attr('placeholder', $(this).data('placeholder')); }); $('.select2-search__field').css('width', '100%'); 试试这个代码 在你的javascript中 $('.select2-search__field').addClass('w-100') 或 $('.select2-search__field').css('width', '100%') 占位符标签不是选择列表的有效属性 你可以使用这样的东西: <select class="form-control select2" multiple="multiple" id="select2"> <option selected="selected">cawky parky</option> <option>ahoj</option> <option>more</option> <option>ideme</option> <option>na </option> <option>pivo?</option> </select> 然后编写适当的 jquery 在你的select2-Bootstrap例子中是完全不同的结构 我在引导选项卡中有一些 select2 输入。 对我有用的解决方案: .select2-search--inline { display: contents; /*this will make the container disappear, making the child the one who sets the width of the element*/ } .select2-search__field:placeholder-shown { width: 100% !important; /*makes the placeholder to be 100% of the width while there are no options selected*/ }

回答 14 投票 0

是否建议使用简单的CSS类,如.text-center? [关闭]

我正在学习HTML / CSS,我看过一些例子,比如使用.text-center for text-align:center; (在Bootstrap3中)。这对我来说有点奇怪,因为这些类的css样式永远不会......

回答 1 投票 -1

如何在html选择中使用Bootstrap 3 glyphicon

我需要让用户在我的ui中选择Bootstrap 3 glyphicons的子集。我试过这个:

回答 4 投票 18

如何将数据切换与数据工具提示相结合?

像这样,我的数据切换效果很好:

回答 1 投票 0

如何使用jquery更改模态中的文本?

大家好我试图用pokeapi创建一个pokedex。我的模态看起来像这样:

回答 3 投票 -2

HTML / Bootstrap表溢出以及如何解决它

我有一个表单,其中用户可以搜索例如名称。搜索完表后会出来。它在桌面上完美运行但是你知道我使用了bootstrap,它具有响应性和可用性......

回答 2 投票 1

如何调整选择文本?

我必须减少表单字段的高度,它在除了被破坏的select选项之外的所有字段上都能正常工作。如果有办法,它似乎是采取顶部填充除了大小...

回答 1 投票 0

以编程方式扩展列表

使用bootstrap项目,我有以下代码来构建一个区域,我可以在其中显示一组选项,可以选择进一步的操作。像这样:

回答 2 投票 1

Bootstrap 4表响应tbody滚动

使用Bootstrap 4.我有一个响应表,我想在其中制作一个可滚动的tbody。表看起来像这样:

回答 2 投票 0

Bootstrap垂直滚动标签

我有这个代码:var hidWidth; var scrollBarWidths = 40; var widthOfList = function(){var itemsWidth = 0; $('。list li')。each(function(){var itemWidth = $(this).outerWidth(); ...

回答 1 投票 0

未捕获的ReferenceError:使用btn按钮分配无效的左侧

只有在预订了优惠条目时,才会在基本条目中显示通过引导按钮的链接。这应在Worldsoft CMS的门户模块中实现。第一个解决方案有效......

回答 1 投票 0

无法隐藏注册链接

我想在我的网站上登录弹出窗口(登录指南Alpine)中隐藏注册链接“Non sei registration”:https://www.guidealpine365.it/我尝试过下面的CSS代码:....

回答 1 投票 0

角材料有网格系统吗?

我正在开始一个有角度材料的项目。它是否有一个原生系统用于在响应网格中定位元素,如bootstrap?否则,结合材料设计是可行的......

回答 3 投票 6

未捕获的TypeError无法读取null的属性“classlist”

我一直在阅读这个问题的其他可能重复,但我仍然没有找到完成此任务所需的解决方案。所以,我下载了一个CSS文件,其中包含适用于所有宽度的汉堡包,...

回答 1 投票 0

如何在动态内容插入后重新定位Bootstrap Popover?

因此,基本上每当我使用空内容选项加载Bootstrap Popover并动态插入内容时,弹出窗口就会失去正确的位置。例如:$('td.chartSection'...

回答 8 投票 19

© www.soinside.com 2019 - 2024. All rights reserved.