"Untitled"
Bootstrap 4.1.1 Snippet by divyalahad

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="principal">
<h2>Properties for the flex container</h2>
<div class="control">
<h4><a href="http://w3.unpocodetodo.info/css3/flex-direction.php">flex-direction</a> <small>( property of the flex container )</small></h4><!--flex-direction: row | row-reverse | column | column-reverse;-->
<div class="radio">
<input name="flex-direction" type="radio" class="flex-direction" id="R11" value="row" checked><label for="R11">row:</label>
<input name="flex-direction" type="radio" class="flex-direction" id="R12" value="row-reverse"><label for="R12">row-reverse:</label>
<input name="flex-direction" type="radio" class="flex-direction" id="R13" value="column"><label for="R13">column:</label>
<input name="flex-direction" type="radio" class="flex-direction" id="R14" value="column-reverse"><label for="R14">column-reverse:</label>
</div></div>
<div class="flex-container" id="direction">
<div class="item" data-color="2a80b9"><p>1</p></div>
<div class="item" data-color="8f44ad"><p>2</p></div>
<div class="item" data-color="16a086"><p>3</p></div>
<div class="item" data-color="f1c40f"><p>4</p></div>
<div class="item" data-color="e77e23"><p>5</p></div>
</div>
<div class="control">
<h4><a href="http://w3.unpocodetodo.info/css3/flex-wrap.php">flex-wrap</a> <small>( property of the flex container )</small></h4><!--nowrap | wrap | wrap-reverse;-->
<div class="radio">
<input name="flex-wrap" type="radio" class="flex-wrap" id="R21" value="nowrap" checked><label for="R21">nowrap:</label>
<input name="flex-wrap" type="radio" class="flex-wrap" id="R22" value="wrap"><label for="R22">wrap:</label>
<input name="flex-wrap" type="radio" class="flex-wrap" id="R23" value="wrap-reverse"><label for="R23">wrap-reverse:</label>
</div></div>
<div class="flex-container" id="wrap">
<div class="item" data-color="2a80b9"><p>1</p></div>
<div class="item" data-color="8f44ad"><p>2</p></div>
<div class="item" data-color="16a086"><p>3</p></div>
<div class="item" data-color="f1c40f"><p>4</p></div>
<div class="item" data-color="e77e23"><p>5</p></div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*flex-direction: row | row-reverse | column | column-reverse;*/
.flex-container.row {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
.flex-container.row-reverse {
-webkit-flex-direction: row-reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.flex-container.column {
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.flex-container.column-reverse {
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column-reverse;
}
/*flex-wrap: nowrap | wrap | wrap-reverse;*/
.flex-container.nowrap {
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
}
.flex-container.wrap {
-webkit-flex-wrap: wrap;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function changeFlex(e, t) {
for (var n = document.querySelectorAll("." + e), l = document.querySelector("#" + t), r = 0; r < n.length; r++) n[r].addEventListener("change", function() {
var e = this.value;
l.setAttribute("class", "flex-container " + e)
}, !1)
}
function changeItemFlex(e, t) {
for (var n = document.querySelectorAll("." + e), l = document.querySelector("#" + t), r = 0; r < n.length; r++) n[r].addEventListener("change", function() {
var e = this.value;
l.setAttribute("class", "item " + e)
}, !1)
}
function changeFlexBasis(e, t) {
var n = isNaN(e.value) ? 0 : e.value;
console.log("B: " + n), document.querySelector("#" + t).style.WebkitFlexBasis = n + "%", document.querySelector("#" + t).style.flexBasis = n + "%"
}
function changeFlexGrow(e, t) {
var n = isNaN(e.value) ? 0 : e.value;
console.log("G: " + n), document.querySelector("#" + t).style.WebkitFlexGrow = n, document.querySelector("#" + t).style.flexGrow = n
}
function changeFlexShrink(e, t) {
var n = isNaN(e.value) ? 0 : e.value;
console.log("S: " + n), document.querySelector("#" + t).style.WebkitFlexShrink = n, document.querySelector("#" + t).style.flexShrink = n
}
function changeFlexOrder(e, t) {
var n = isNaN(e.value) ? 0 : e.value;
console.log("O: " + n), document.querySelector("#" + t).style.WebkitOrder = n, document.querySelector("#" + t).style.order = n
}
function changeAll(e, t, n, l) {
changeFlexBasis(e, l), changeFlexGrow(t, l), changeFlexShrink(n, l)
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: