Skip to content

Commit fdc74c6

Browse files
author
AMJones
committed
Adds breakpoint detection JQuery plugin.
1 parent 6d80b0f commit fdc74c6

File tree

7 files changed

+57
-4
lines changed

7 files changed

+57
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"css"
1111
],
1212
"homepage": "https://www.github.com/strapless/display",
13-
"version": "1.0.1",
13+
"version": "1.0.2",
1414
"authors": [
1515
{
1616
"name": "Aaron M Jones",

dist/css/strapless-display.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Strapless Display v1.0.1 (http://github.com/strapless/display)
2+
* Strapless Display v1.0.2 (http://github.com/strapless/display)
33
* Influenced by Bootstrap v4.0 (http://getbootstrap.com)
44
* Licensed under MIT (https://github.com/strapless/display/blob/master/LICENSE)
55
*/

dist/css/strapless-display.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/strapless-display.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Determines which breakpoint is currently active.
3+
*
4+
* @returns {jQuery}
5+
*/
6+
jQuery.fn.extend( {
7+
isBreakpoint: function ( points ) {
8+
var test = false;
9+
var $body = $( 'body' );
10+
var cls = ' d-none d-sm-none d-md-none d-lg-none d-xl-none';
11+
if ( !points.constructor === Array ) { points = [ points ]; }
12+
$.each( points, function ( index, alias ) {
13+
if ( !$body.find( '.detect-' + alias ).length ) {
14+
var tCls = 'detect-' + alias + cls;
15+
tCls = (alias === 'xs') ? tCls.replace('d-none','d-inline') : tCls.replace(alias + '-none',alias + '-inline');
16+
$body.append( '<span class="' + tCls + '"></span>' );
17+
}
18+
if ( $( '.detect-' + alias ).first().is( ':visible' ) ) {
19+
test = true;
20+
return false;
21+
}
22+
} );
23+
return test
24+
}
25+
} );

dist/js/strapless-display.min.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/breakpoint.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Determines which breakpoint is currently active.
3+
*
4+
* @returns {jQuery}
5+
*/
6+
jQuery.fn.extend( {
7+
isBreakpoint: function ( points ) {
8+
var test = false;
9+
var $body = $( 'body' );
10+
var cls = ' d-none d-sm-none d-md-none d-lg-none d-xl-none';
11+
if ( !points.constructor === Array ) { points = [ points ]; }
12+
$.each( points, function ( index, alias ) {
13+
if ( !$body.find( '.detect-' + alias ).length ) {
14+
var tCls = 'detect-' + alias + cls;
15+
tCls = (alias === 'xs') ? tCls.replace('d-none','d-inline') : tCls.replace(alias + '-none',alias + '-inline');
16+
$body.append( '<span class="' + tCls + '"></span>' );
17+
}
18+
if ( $( '.detect-' + alias ).first().is( ':visible' ) ) {
19+
test = true;
20+
return false;
21+
}
22+
} );
23+
return test
24+
}
25+
} );

scss/_display.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@if not($enable-framework) {
55
/*!
6-
* Strapless Display v1.0.1 (http://github.com/strapless/display)
6+
* Strapless Display v1.0.2 (http://github.com/strapless/display)
77
* Influenced by Bootstrap v4.0 (http://getbootstrap.com)
88
* Licensed under MIT (https://github.com/strapless/display/blob/master/LICENSE)
99
*/

0 commit comments

Comments
 (0)