Skip to content

Commit f583fc5

Browse files
committed
port 2e8299d as part of #80
1 parent 7d82e98 commit f583fc5

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

src/js/styleguide.js

+28-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,26 @@
77
(function (w) {
88

99
var sw = document.body.clientWidth, //Viewport Width
10-
sh = $(document).height(), //Viewport Height
11-
minViewportWidth = parseInt(config.ishMinimum), //Minimum Size for Viewport
12-
maxViewportWidth = parseInt(config.ishMaximum), //Maxiumum Size for Viewport
13-
viewportResizeHandleWidth = 14, //Width of the viewport drag-to-resize handle
10+
sh = $(document).height(); //Viewport Height
11+
12+
var minViewportWidth = 240;
13+
var maxViewportWidth = 2600;
14+
15+
//set minimum and maximum viewport based on confg
16+
if (config.ishMinimum !== undefined) {
17+
minViewportWidth = parseInt(config.ishMinimum); //Minimum Size for Viewport
18+
}
19+
if (config.ishMaximum !== undefined) {
20+
maxViewportWidth = parseInt(config.ishMaximum); //Maxiumum Size for Viewport
21+
}
22+
23+
//alternatively, use the ishViewportRange object
24+
if (config.ishViewportRange !== undefined) {
25+
minViewportWidth = config.ishViewportRange.s[0];
26+
maxViewportWidth = config.ishViewportRange.l[1];
27+
}
28+
29+
var viewportResizeHandleWidth = 14, //Width of the viewport drag-to-resize handle
1430
$sgIframe = $('.pl-js-iframe'), //Viewport element
1531
$sizePx = $('#pl-size-px'), //Px size input element in toolbar
1632
$sizeEms = $('#pl-size-em'), //Em size input element in toolbar
@@ -80,7 +96,10 @@
8096
killDisco();
8197
killHay();
8298
fullMode = false;
83-
sizeiframe(getRandom(500, 800));
99+
sizeiframe(getRandom(
100+
minViewportWidth,
101+
config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.s[1]) : 500
102+
));
84103
}
85104

86105
$('#pl-size-m').on("click", function (e) {
@@ -98,7 +117,10 @@
98117
killDisco();
99118
killHay();
100119
fullMode = false;
101-
sizeiframe(getRandom(800, 1200));
120+
sizeiframe(getRandom(
121+
config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.l[0]) : 800,
122+
config.ishViewportRange !== undefined ? parseInt(config.ishViewportRange.l[1]) : 1200
123+
));
102124
}
103125

104126
$('#pl-size-l').on("click", function (e) {

0 commit comments

Comments
 (0)