Skip to content

Commit 8e32d98

Browse files
author
AMJones
committed
Adds responsive plugins, updates dependency.
1 parent a40a52e commit 8e32d98

File tree

4 files changed

+65
-34
lines changed

4 files changed

+65
-34
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"sass",
77
"scss",
88
"strapless",
9-
"css"
9+
"rwd"
1010
],
1111
"homepage": "https://www.github.com/strapless/responsive",
12-
"version": "1.0",
12+
"version": "1.0.1",
1313
"authors": [
1414
{
1515
"name": "Aaron M Jones",
@@ -18,7 +18,7 @@
1818
],
1919
"license": "MIT",
2020
"require": {
21-
"strapless/base": "^1.1",
21+
"strapless/base": "^2.0",
2222
"exactquery/xq-detect": "^2.2"
2323
}
2424
}

js/afterwards.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Fires an event after the last repeated event. Useful for resize & similar events.
3+
*
4+
* @returns {jQuery}
5+
*/
6+
;(function($){
7+
$.fn.extend({
8+
afterwards: function( eventName, callback, options ) {
9+
10+
var plugin = this;
11+
var $plugin = $(plugin);
12+
var eTimer;
13+
14+
plugin.defaultOptions = {
15+
'interval': 250,
16+
'preventDefault': false,
17+
'stopPropagation': false
18+
};
19+
20+
var settings = $.extend({}, plugin.defaultOptions, options);
21+
22+
return $plugin.on(eventName, function(e) {
23+
24+
if ( settings.preventDefault ) { e.preventDefault(); }
25+
if ( settings.stopPropagation ) { e.stopPropagation(); }
26+
if ( settings.stopImmediatePropagation ) { e.stopImmediatePropagation(); }
27+
28+
clearTimeout(eTimer);
29+
eTimer = setTimeout(callback, settings.interval);
30+
});
31+
}
32+
});
33+
})(jQuery);

js/breakpoint.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Determines which breakpoint is currently active, either by querying for a psuedo element on the body
3+
* or by injecting an element with display classes.
4+
*
5+
* @returns {jQuery}
6+
*/
7+
jQuery.fn.extend( {
8+
isBreakpoint: function ( points ) {
9+
var query = window.getComputedStyle(document.querySelector('body'), ':before').getPropertyValue('content').replace(/\"/g, '') || null;
10+
if ( !points.constructor === Array ) { points = [ points ]; }
11+
if (null !== query) { return (points.indexOf(query) !== -1); }
12+
var test = false;
13+
var $body = $( 'body' );
14+
var cls = ' d-none d-sm-none d-md-none d-lg-none d-xl-none';
15+
$.each( points, function ( index, alias ) {
16+
if ( !$body.find( '.detect-' + alias ).length ) {
17+
var tCls = 'detect-' + alias + cls;
18+
tCls = (alias === 'xs') ? tCls.replace('d-none','d-inline') : tCls.replace(alias + '-none',alias + '-inline');
19+
$body.append( '<span class="' + tCls + '"></span>' );
20+
}
21+
if ( $( '.detect-' + alias ).first().is( ':visible' ) ) {
22+
test = true;
23+
return false;
24+
}
25+
} );
26+
return test
27+
}
28+
} );

scss/_rwd-functions.scss

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,9 @@
11
@import "rwd-variables";
2-
@import "strapless/base/scss/functions/map";
2+
@import "strapless/base/scss/base";
33

44
// region //////////////////////////////////////////////// String Functions
55

6-
// Explodes a string into a SASS list by the given delimiter
7-
// @author Hugo Giraudel (modified from original)
8-
@function _str-explode($string, $delimiter: "") {
9-
$result: ();
10-
$length: str-length($string);
116

12-
@if str-length($delimiter) == 0 {
13-
@for $i from 1 through $length {
14-
$result: append($result, str-slice($string, $i, $i));
15-
}
16-
17-
@return $result;
18-
}
19-
20-
$running: true;
21-
$remaining: $string;
22-
23-
@while $running {
24-
$index: str-index($remaining, $delimiter);
25-
26-
@if $index {
27-
$slice: str-slice($remaining, 1, $index - 1);
28-
$result: append($result, $slice);
29-
$remaining: str-slice($remaining, $index + str-length($delimiter));
30-
} @else {
31-
$running: false;
32-
}
33-
}
34-
35-
@return append($result, $remaining);
36-
}
377

388
// endregion ///////////////////////////////////////////// End String Functions
399

0 commit comments

Comments
 (0)