Skip to content

Instantly share code, notes, and snippets.

@esseti

esseti/script.js Secret

Created March 30, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esseti/6609b19a9023b3899878f3860de52417 to your computer and use it in GitHub Desktop.
Save esseti/6609b19a9023b3899878f3860de52417 to your computer and use it in GitHub Desktop.
$(document).ready(function () {
//this makes all the panels of the same size
function resize_panel(selector, what) {
if (what == undefined)
what = '.panel-body';
var objs = $(selector).find(what);
var o_h = 0;
objs.each(function () {
if (o_h < $(this).height()) {
o_h = $(this).height();
}
});
objs.each(function () {
$(this).height(o_h);
});
};
resize_panel('.panel', '.panel-heading');
resize_panel('.panel', '.panel-body');
resize_panel('.panel', '.panel-footer');
//this adds panel-primary (green stuff) to the panel when checkbox is selected
$('.purpose').click(function () {
var checkbox = $(this).find('input[type=checkbox]');
console.log($(this));
checkbox.prop("checked", !checkbox.prop("checked"));
if (checkbox.prop("checked")) {
$(this).addClass('panel-primary');
} else {
$(this).removeClass('panel-primary');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment