Commit 1a5992b5 authored by Phil Hughes's avatar Phil Hughes

Changed breakpoint size

Changed breakpoint class into singleton
parent 23b0eeca
......@@ -108,8 +108,7 @@ window.onload = ->
setTimeout shiftWindow, 100
$ ->
breakpoints = new Breakpoints()
bootstrapBreakpoint = breakpoints.getBreakpointSize()
bootstrapBreakpoint = bp.getBreakpointSize()
$(".nicescroll").niceScroll(cursoropacitymax: '0.4', cursorcolor: '#FFF', cursorborder: "1px solid #FFF")
......@@ -261,12 +260,12 @@ $ ->
fitSidebarForSize = ->
oldBootstrapBreakpoint = bootstrapBreakpoint
bootstrapBreakpoint = breakpoints.getBreakpointSize()
bootstrapBreakpoint = bp.getBreakpointSize()
if bootstrapBreakpoint != oldBootstrapBreakpoint
$(document).trigger('breakpoint:change', [bootstrapBreakpoint])
checkInitialSidebarSize = ->
bootstrapBreakpoint = breakpoints.getBreakpointSize()
bootstrapBreakpoint = bp.getBreakpointSize()
if bootstrapBreakpoint is "xs" or "sm"
$(document).trigger('breakpoint:change', [bootstrapBreakpoint])
......
class @Breakpoints
BREAKPOINTS = ["xs", "sm", "md", "lg"]
instance = null;
constructor: ->
@setup()
class BreakpointInstance
BREAKPOINTS = ["xs", "sm", "md", "lg"]
setup: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
constructor: ->
@setup()
if $(allDeviceSelector.join(",")).length
return
setup: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
# Create all the elements
$.each BREAKPOINTS, (i, breakpoint) ->
$("body").append "<div class='device-#{breakpoint} visible-#{breakpoint}'></div>"
return if $(allDeviceSelector.join(",")).length
getBreakpointSize: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
# Create all the elements
$.each BREAKPOINTS, (i, breakpoint) ->
$("body").append "<div class='device-#{breakpoint} visible-#{breakpoint}'></div>"
$visibleDevice = $(allDeviceSelector.join(",")).filter(":visible")
return $visibleDevice.attr("class").split("visible-")[1]
getBreakpointSize: ->
@setup()
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
$visibleDevice = $(allDeviceSelector.join(",")).filter(":visible")
return $visibleDevice.attr("class").split("visible-")[1]
@get: ->
return instance ?= new BreakpointInstance
@bp = Breakpoints.get()
mobileWidth = 991
collapsed = 'page-sidebar-collapsed'
expanded = 'page-sidebar-expanded'
......@@ -21,8 +20,7 @@ $(document).on("click", '.toggle-nav-collapse', (e) ->
)
$ ->
breakpoints = new Breakpoints()
size = breakpoints.getBreakpointSize()
size = bp.getBreakpointSize()
if size is "xs" or size is "sm"
if $('.page-with-sidebar').hasClass(expanded)
......
......@@ -144,7 +144,7 @@ header {
.header-collapsed {
margin-left: $sidebar_collapsed_width;
@media (min-width: $screen-sm-max) {
@media (min-width: $screen-md-min) {
@include collapsed-header;
}
}
......@@ -152,7 +152,7 @@ header {
.header-expanded {
margin-left: $sidebar_collapsed_width;
@media (min-width: $screen-sm-max) {
@media (min-width: $screen-md-min) {
margin-left: $sidebar_width;
}
}
......
......@@ -34,7 +34,7 @@
@media (min-width: $screen-sm-min) {
padding-right: $gutter_width;
}
}
}
......@@ -205,7 +205,7 @@
@mixin expanded-sidebar {
padding-left: $sidebar_collapsed_width;
@media (min-width: $screen-sm-max) {
@media (min-width: $screen-md-min) {
padding-left: $sidebar_width;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment