Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-11 18:11:11 +0300
committerPhil Hughes <me@iamphill.com>2016-03-14 14:39:56 +0300
commitf0f6723fe02bfb1a79c1cbefed156a420dddc352 (patch)
tree493a93b8c22abe55e45791bc6ff2c2e3e6b79c42 /app/assets/javascripts/breakpoints.coffee
parentce9bbce78a258b43181766bcbebad7add90968ff (diff)
Created bootstrap breakpoint class
This class checks the current bootstrap breakpoint
Diffstat (limited to 'app/assets/javascripts/breakpoints.coffee')
-rw-r--r--app/assets/javascripts/breakpoints.coffee24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/assets/javascripts/breakpoints.coffee b/app/assets/javascripts/breakpoints.coffee
new file mode 100644
index 00000000000..fd2ee8efa2c
--- /dev/null
+++ b/app/assets/javascripts/breakpoints.coffee
@@ -0,0 +1,24 @@
+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]