Files
gitlabhq/app/assets/javascripts/breakpoints.coffee
T
Phil Hughes f0f6723fe0 Created bootstrap breakpoint class
This class checks the current bootstrap breakpoint
2016-03-14 11:39:56 +00:00

25 lines
661 B
CoffeeScript

class @Breakpoints
BREAKPOINTS = ["xs", "sm", "md", "lg"]
constructor: ->
@setup()
setup: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
if $(allDeviceSelector.join(",")).length
return
# Create all the elements
$.each BREAKPOINTS, (i, breakpoint) ->
$("body").append "<div class='device-#{breakpoint} visible-#{breakpoint}'></div>"
getBreakpointSize: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
$visibleDevice = $(allDeviceSelector.join(",")).filter(":visible")
return $visibleDevice.attr("class").split("visible-")[1]