(function($){ $(function() { /////////////////////////////////////////////// // // GET app settings // ////////////////////////////////////////// $.getJSON('_setup.json', function(app) //app is data { //console.log(app.name); //avoid this window.app = app; //var AppName = app.name; $('.button-collapse').sideNav( { menuWidth: 300, edge: 'right', closeOnClick: true, draggable: true }); $('.parallax').parallax(); //mighty js prototypoe functions function doCalculate_set() { //console.log("_set size") $("._set").each(function(index, element) { var w,h; var wpercent = $(this).attr("data-set-width")/100; var hpercent = $(this).attr("data-set-height")/100; if ( this.id == 'primary-photo' && $(window).width() < 992 ) { hpercent = 0.7; } if ( $(this).attr("data-set-source") == undefined ) { //assume window if (wpercent && wpercent !== false) { // Element has this attribute w = $(window).width() * wpercent; }else{ w = $(window).width(); } if (hpercent && hpercent !== false) { // Element has this attribute h = $(window).height() * hpercent; }else{ h = $(window).height(); } }else{ //use name of object as source, must be an id var source = $(this).attr("data-set-source"); if (wpercent && wpercent !== false) { // Element has this attribute $(this).css("width", ""); w = $("#" + source).width() * wpercent; } if (hpercent && hpercent !== false) { // Element has this attribute $(this).css("height", ""); h = $("#" + source).innerHeight() * hpercent; } } $(this).css({ height: h +"px", width: w +"px" }); }); //console.log($(window).height()-30); //update size of home page grid if ( $(window).width() > ($(window).height()-30) ) { $("._x5").finish().animate({"width":"20%","opacity":1}, 0); } } doCalculate_set(); //on screen size change $(window).resize(function(){ doCalculate_set(); }); // Listen for orientation changes window.addEventListener("orientationchange", function() { doCalculate_set(); }, false); //$("html, body").animate({ scrollTop: 20000 }, "slow"); /////////////////////////////////////////////// // // NAV MENU CODING // ////////////////////////////////////////// var transition_time = 120; $("[id^=menu_1]").css({position:'absolute',width:'100%'},0); $("[id^=menu_11]").animate({left:'+600px'},0); $("#menu_1 li.slidemenu").click(function(){ $("#nav_name").text('Education'); $("#menu_1").animate({left:'+600px'},0, function(){ $("#menu_11").delay(200).animate({left:'0px'},transition_time); }); }); $("#menu_11 li.slidemenu").click(function(){ $("#nav_name").text('Classroom'); $("#menu_11").animate({width:'toggle'},0, function(){ $("#menu_111").delay(200).animate({left:'0px'},transition_time); }); }); /////////////////////////////////////////////// // // Mighty // ////////////////////////////////////////// //hover function $("html").on("mouseenter", ".hand", function() { $(this).css( 'cursor', 'pointer' ); }); /////////////////////////////////////////////// // // Developer link // ////////////////////////////////////////// $("div#cherub").parent().mouseenter(function() { $( this ).children("#cherub").animate({ opacity: 1 }, 2500, function() { // Animation complete. }); }) .mouseleave(function() { $( this ).children("#cherub").animate({ opacity: 0.25 }, 2500, function() { // Animation complete. }); }); }); }); // end of document ready })(jQuery); // end of jQuery name space