Responsive behavior
The select has a liquid layout, which means it nicely adapts to its surroundings. There are times however when you would like to set up the component responsively.
Use the responsive option to configure the picker and change the options based on the viewport width. There are five predefined breakpoints:
xsmall- min-width: 0pxsmall- min-width: 576pxmedium- min-width: 768pxlarge- min-width: 992pxxlarge- min-width: 1200px- use
customfor setting a custombreakpoint
It is a good idea to change the display or controls option to tailor the UX. This way you can have a bottom positioned picker on mobile, a popover anchored to the input on tablet and desktop display on large screens.
Demo
responsive: {
}
mobiscroll.setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
mobiscroll.select('#demo-responsive', {
inputElement: document.getElementById('demo-responsive-input'),
responsive: {
xsmall: {
display: 'bottom',
},
small: {
display: 'anchored',
},
custom: {
// Custom breakpoint
breakpoint: 800,
display: 'anchored',
touchUi: false,
},
},
});
<label>
Select
<input mbsc-input id="demo-responsive-input" placeholder="Please select..." data-dropdown="true" data-input-style="outline" data-label-style="stacked" />
</label>
<select id="demo-responsive">
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</select>