Skip to content

Commit a918a05

Browse files
committed
Initial commit of Isolate plugin
1 parent 8d157a3 commit a918a05

8 files changed

Lines changed: 277 additions & 1 deletion

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
jQuery-Isolate
22
==============
33

4-
Isolate is a jQuery plugin that isolates or filters elements on a page by clicking their associated button. The plugin is feature rich and framework-aware with init properties to dynamically generate optional grid classes for Bootstrap 3, Bootstrap 2 or a custom scaffolding inspired by BS3.
4+
Isolate is a jQuery plugin that isolates or filters elements on a page by clicking their associated button. Isolate is customizable and framework-aware with init properties to dynamically generate optional grid classes for Bootstrap 3, Bootstrap 2 or a custom scaffolding inspired by BS3.

css/jquery.isolate.css

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

css/jquery.isolate.css.map

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

css/jquery.isolate.min.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+

2+
/*
3+
* Scaffolding for Isolate Plugin (jQuery JavaScript Library)
4+
*
5+
* Copyright (c) 2014 Adam J De Lucia
6+
* Licensed under the MIT License.
7+
* http://opensource.org/licenses/MIT
8+
*
9+
* Author: Adam J De Lucia
10+
* Scaffolding Version: 0.3.0 (Isolate 1.0.0)
11+
* Date: May 23 2014
12+
*
13+
*/
14+
15+
.bs-2-row-start{margin-left:0}[class*="iso-col-"]{position:relative;min-height:1px;float:left;padding-left:15px;padding-right:15px}.iso-col-1{width:8.33333333%}.iso-col-2{width:16.66666667%}.iso-col-3{width:25%}.iso-col-4{width:33.33333333%}.iso-col-5{width:20%}.iso-col-6{width:50%}.iso-col-7{width:58.33333333%}.iso-col-8{width:66.66666667%}.iso-col-9{width:75%}.iso-col-10{width:83.33333333%}.iso-col-11{width:91.66666667%}.iso-col-12{width:100%}

js/jquery.isolate.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+

2+
/*
3+
* Isolate Plugin for jQuery JavaScript Library
4+
*
5+
* Copyright (c) 2014 Adam J De Lucia
6+
* Licensed under the MIT License.
7+
* http://opensource.org/licenses/MIT
8+
*
9+
* Author: Adam J De Lucia
10+
* Version: 1.0.0
11+
* Date: May 23 2014
12+
*
13+
*/
14+
15+
$.fn.isolate = function (options) {
16+
var settings = $.extend({
17+
filtersBox: $("#iso-filters"),
18+
isosBox: $("#iso-els"),
19+
isoWrapper: "li",
20+
bootstrap: true,
21+
version: 3,
22+
breakpoint: "md",
23+
columns: false,
24+
colSpan: 3,
25+
filter: false
26+
}, options);
27+
28+
var str = settings.version.toString();
29+
var version = str.substring(0, 1);
30+
31+
var isolate = function () {
32+
currentIso = $(this).attr("id");
33+
iso = "." + $(this).attr("id");
34+
els = settings.isosBox.find($(settings.isoWrapper).not(iso));
35+
36+
if (currentIso != oldIso && oldIso != "") {
37+
settings.isosBox.find($(settings.isoWrapper).not("." + oldIso)).show();
38+
}
39+
40+
els.toggle(0, rowStart);
41+
oldIso = $(this).attr("id");
42+
};
43+
44+
var filter = function () {
45+
currentIso = $(this).attr("id");
46+
iso = "." + $(this).attr("id");
47+
el = settings.isosBox.find(iso);
48+
49+
if (currentIso != oldIso && oldIso != "") {
50+
$("." + oldIso).show();
51+
}
52+
53+
el.toggle(0, rowStart);
54+
oldIso = $(this).attr("id");
55+
};
56+
57+
if (settings.bootstrap == true || settings.columns == true) {
58+
if (settings.bootstrap == true) {
59+
if (version == "3") {
60+
settings.isosBox.find(settings.isoWrapper).addClass("col-" + settings.breakpoint + "-" + settings.colSpan);
61+
} else if (version == "2") {
62+
settings.isosBox.find(settings.isoWrapper).addClass("span" + settings.colSpan);
63+
rowStart();
64+
} else { alert("Isolate supports Bootstrap versions 2 and 3. You entered version " + version + ".\n\n Please use a supported version."); }
65+
} else {
66+
settings.isosBox.find(settings.isoWrapper).addClass("iso-col-" + settings.colSpan);
67+
}
68+
}
69+
70+
if (settings.filter == true) {
71+
settings.filtersBox.on("click.isolate", ".filter", filter);
72+
} else {
73+
settings.filtersBox.on("click.isolate", ".filter", isolate);
74+
}
75+
76+
function rowStart() {
77+
if (settings.bootstrap == true && version == "2") {
78+
settings.isosBox.find(settings.isoWrapper).removeClass("bs-2-row-start");
79+
settings.isosBox.find(settings.isoWrapper).filter(function () {
80+
return $(this).css("display") != "none";
81+
}).each(function (index) {
82+
if (settings.colSpan > 6) {
83+
$(this).addClass("bs-2-row-start");
84+
} else if (settings.colSpan == 5 || settings.colSpan == 6) {
85+
if (index % 2 == 0) {
86+
$(this).addClass("bs-2-row-start");
87+
}
88+
} else if ((index + 1) % (12 / settings.colSpan + 1) == 0) {
89+
$(this).addClass("bs-2-row-start");
90+
}
91+
});
92+
}
93+
}
94+
95+
var iso = "";
96+
var el = "";
97+
var els = "";
98+
var currentIso = "";
99+
var oldIso = "";
100+
};

js/jquery.isolate.min.js

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

js/jquery.isolate.min.js.map

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

less/jquery.isolate.less

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
/*
3+
* Scaffolding for Isolate Plugin (jQuery JavaScript Library)
4+
*
5+
* Copyright (c) 2014 Adam J De Lucia
6+
* Licensed under the MIT License.
7+
* http://opensource.org/licenses/MIT
8+
*
9+
* Author: Adam J De Lucia
10+
* Scaffolding Version: 0.3.0 (Isolate 1.0.0)
11+
* Date: May 23 2014
12+
*
13+
*/
14+
15+
.bs-2-row-start {
16+
margin-left: 0;
17+
}
18+
19+
[class*="iso-col-"] {
20+
position: relative;
21+
min-height: 1px;
22+
float: left;
23+
padding-left: 15px;
24+
padding-right: 15px;
25+
}
26+
27+
.iso-col-1 {
28+
width: 8.33333333%;
29+
}
30+
31+
.iso-col-2 {
32+
width: 16.66666667%;
33+
}
34+
35+
.iso-col-3 {
36+
width: 25%;
37+
}
38+
39+
.iso-col-4 {
40+
width: 33.33333333%;
41+
}
42+
43+
.iso-col-5 {
44+
width: 20%;
45+
}
46+
47+
.iso-col-6 {
48+
width: 50%;
49+
}
50+
51+
.iso-col-7 {
52+
width: 58.33333333%;
53+
}
54+
55+
.iso-col-8 {
56+
width: 66.66666667%;
57+
}
58+
59+
.iso-col-9 {
60+
width: 75%;
61+
}
62+
63+
.iso-col-10 {
64+
width: 83.33333333%;
65+
}
66+
67+
.iso-col-11 {
68+
width: 91.66666667%;
69+
}
70+
71+
.iso-col-12 {
72+
width: 100%;
73+
}

0 commit comments

Comments
 (0)