/*! * Author: Abdullah A Almsaeed * Date: 4 Jan 2014 * Description: * This file should be included in all pages !**/ $(function() { "use strict"; //Enable sidebar toggle $("[data-toggle='offcanvas']").click(function(e) { e.preventDefault(); //If window is small enough, enable sidebar push menu if ($(window).width() <= 992) { $('.row-offcanvas').toggleClass('active'); $('.left-side').removeClass("collapse-left"); $(".right-side").removeClass("strech"); $('.row-offcanvas').toggleClass("relative"); } else { //Else, enable content streching $('.left-side').toggleClass("collapse-left"); $(".right-side").toggleClass("strech"); } }); //Add hover support for touch devices $('.btn').bind('touchstart', function() { $(this).addClass('hover'); }).bind('touchend', function() { $(this).removeClass('hover'); }); //Activate tooltips $("[data-toggle='tooltip']").tooltip(); /* * Add collapse and remove events to boxes */ $("[data-widget='collapse']").click(function() { //Find the box parent var box = $(this).parents(".box").first(); //Find the body and the footer var bf = box.find(".box-body, .box-footer"); if (!box.hasClass("collapsed-box")) { box.addClass("collapsed-box"); bf.slideUp(); } else { box.removeClass("collapsed-box"); bf.slideDown(); } }); /* * ADD SLIMSCROLL TO THE TOP NAV DROPDOWNS * --------------------------------------- */ $(".navbar .menu").slimscroll({ height: "200px", alwaysVisible: false, size: "3px" }).css("width","100%"); /* * INITIALIZE BUTTON TOGGLE * ------------------------ */ $('.btn-group[data-toggle="btn-toggle"]').each(function() { var group = $(this); $(this).find(".btn").click(function(e) { group.find(".btn.active").removeClass("active"); $(this).addClass("active"); e.preventDefault(); }); }); $("[data-widget='remove']").click(function() { //Find the box parent var box = $(this).parents(".box").first(); box.slideUp(); }); /* Sidebar tree view */ $(".sidebar .treeview").tree(); /* * Make sure that the sidebar is streched full height * --------------------------------------------- * We are gonna assign a min-height value every time the * wrapper gets resized and upon page load. We will use * Ben Alman's method for detecting the resize event. **/ //alert($(window).height()); function _fix() { //Get window height and the wrapper height var height = $(window).height() - $("body > .header").height(); $(".wrapper").css("min-height", height + "px"); var content = $(".wrapper").height(); //If the wrapper height is greater than the window if (content > height) //then set sidebar height to the wrapper $(".left-side, html, body").css("min-height", content + "px"); else { //Otherwise, set the sidebar to the height of the window $(".left-side, html, body").css("min-height", height + "px"); } } //Fire upon load _fix(); //Fire when wrapper is resized $(".wrapper").resize(function() { _fix(); }); /* * We are gonna initialize all checkbox and radio inputs to * iCheck plugin in. * You can find the documentation at http://fronteed.com/iCheck/ */ $("input[type='checkbox'], input[type='radio']").iCheck({ checkboxClass: 'icheckbox_minimal', radioClass: 'iradio_minimal' }); /* For demo purposes */ var demo = $("
").css({ position: "fixed", top: "150px", right: "0", background: "rgba(0, 0, 0, 0.7)", "border-radius": "5px 0px 0px 5px", padding: "10px 15px", "font-size": "16px", "z-index": "999999", cursor: "pointer", color: "#ddd" }).html("").addClass("no-print"); var demo_settings = $("").css({ "padding": "10px", position: "fixed", top: "130px", right: "-200px", background: "#fff", border: "3px solid rgba(0, 0, 0, 0.7)", "width": "200px", "z-index": "999999" }).addClass("no-print"); demo_settings.append( "