๐ html
<!-- ็จ <label> ๅ
่ฃ <select> ็ๆจ็ฑคๆๅญ่ๆดๅไธๆๅผ้ธๅฎ -->
<label>
<!-- <select> ๆจ็ฑคๆๅญ -->
flex-direction:
<!-- <select> ไธๆๅผ้ธๅฎ -->
<select id="flexDirection">
<option value="row">row</option>
<option value="row-reverse">row-reverse</option>
<option value="column">column</option>
<option value="column-reverse">column-reverse</option>
</select>
</label>
๐ js
// 1. ๅ
ๆพๅบ id="flex-direction" ็ <select> ๅ
็ด
const flexDirectionSelect = document.getElementById('flexDirection');
// 2. ็ฃ่ฝไธๆๅผ้ธๅฎ็่ฎๆด
flexDirectionSelect.addEventListener('change', updateFlexbox);
// 3. ๆ นๆไธๆๅผ้ธๅฎ็่ฎๆด๏ผๅ็ธๅฐๆ็ๅๆ(ๆดๆฐ flexbox style ๅฑฌๆง)
function updateFlexbox() {
flexContainer.style.flexDirection = flexDirectionSelect.value;
}
ๅฏ็จ <select>
ไพๅๆ
้ธๆ flex ็ๆ็ๆนๅผใ