Improved JavaScript code

This commit is contained in:
Raphael Michel
2015-10-18 17:16:50 +02:00
parent 3fa0cfb077
commit c1af2b1f2d
4 changed files with 74 additions and 62 deletions

View File

@@ -1,10 +1,12 @@
/*global $ */
//Loads the correct sidebar on window load,
//collapses the sidebar on window resize.
// Sets the min-height of #page-wrapper to window size
$(function() {
$(window).bind("load resize", function() {
topOffset = 50;
width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width;
$(function () {
'use strict';
$(window).bind("load resize", function () {
var topOffset = 50,
width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width;
if (width < 768) {
$('div.navbar-collapse').addClass('collapse');
topOffset = 100; // 2-row-menu
@@ -12,7 +14,7 @@ $(function() {
$('div.navbar-collapse').removeClass('collapse');
}
height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1;
var height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1;
height = height - topOffset;
if (height < 1) height = 1;
if (height > topOffset) {

View File

@@ -1,5 +1,8 @@
"use strict";
/*global $*/
$(function () {
"use strict";
var nested_formset_config = {
form: '[data-nested-formset-form]',
emptyForm: 'script[type=form-template][data-nested-formset-empty-form]',