我想要實現的自舉工具欄按鈕作爲與另外的行爲上getbootstrap.com證實:所有按鈕組應該自動切換到垂直模式,當移動設備被使用。轉爲.btn基團的垂直當移動設備被用於
在我看來,最合適的解決方案是這樣的:
.myClass {
@media (max-width: 760px) {
&:extend(.btn-group-vertical all);
}
@media (min-width: 761px) {
&:extend(.btn-group all);
}
}
Unfortenately代碼不起作用。據我瞭解,只有在同一媒體範圍內的課程才能以這種方式擴展。
是否有可能解決這一問題,而無需使用JS?
通過查看如何將所有這些'.btn組-vertical'風格[定義](https://github.com/twbs/bootstrap/blob/v3.3.5/ less/button-groups.less#L140-L196),我認爲不是,沒有辦法(不包括簡單地將所有內容複製粘貼到你的'.myClass')。 (還要注意的是,即使沒有'@ media'問題,它也不得不'擴展',而不僅僅是'擴展')。 –
太糟糕了!事實上,我忘記了'extend'中的'all'關鍵字,編輯了我的問題。 – devwithenth
我試圖爲你做一個小提琴,我認爲那裏不會是非js選項。你可以用visible-xs類創建第二個div,用隱藏xs類創建主div。 https://jsfiddle.net/9ymkx2u1/ –