如何制作div id =" odometerDiv"在窗口调整大小时更改其宽度,以便:
宽度超过600px时,有更大的宽度断点和
600px以下有更小的宽度断点?
以下是我的观察:
https://jsfiddle.net/xawyvwm4/2/
jsFiddle中的第4行:
if($(document).width() > 600) {
this.digits = 6;
this.tenths = 0;
this.digitHeight = 27;
this.digitPadding = 5;
this.digitWidth = 20;
this.bustedness = 2;
this.fontStyle = "font-family: Courier New, Courier, monospace; font-weight: 900;";
this.value = -1;
} else {
this.digits = 6;
this.tenths = 0;
this.digitHeight = 17;
this.digitPadding = 5;
this.digitWidth = 10;
this.bustedness = 2;
this.fontStyle = "font-family: Courier New, Courier, monospace; font-weight: 900;";
this.value = -1;
}
jsFiddle中的第139行:
$(window).on("resize", function() {
odometer();
});