PHP Classes

File: docs/javascripts/main.js

Recommend this page to a friend!
  Classes of Barton Phillips   Simple Site Class   docs/javascripts/main.js   Download  
File: docs/javascripts/main.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Simple Site Class
Simple Site Class
Author: By
Last change:
Date: 1 year ago
Size: 1,692 bytes
 

Contents

Class file image Download
var sectionHeight = function() { var total = $(window).height(), $section = $('section').css('height','auto'); if ($section.outerHeight(true) < total) { var margin = $section.outerHeight(true) - $section.height(); $section.height(total - margin - 20); } else { $section.css('height','auto'); } } $(window).resize(sectionHeight); $(document).ready(function(){ $("section h1, section h2").each(function(){ $("nav ul").append("<li class='tag-" + this.nodeName.toLowerCase() + "'><a href='#" + $(this).text().toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g,'') + "'>" + $(this).text() + "</a></li>"); $(this).attr("id",$(this).text().toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g,'')); $("nav ul li:first-child a").parent().addClass("active"); }); $("nav ul li").on("click", "a", function(event) { var position = $($(this).attr("href")).offset().top - 190; $("html, body").animate({scrollTop: position}, 400); $("nav ul li a").parent().removeClass("active"); $(this).parent().addClass("active"); event.preventDefault(); }); sectionHeight(); $('img').load(sectionHeight); }); fixScale = function(doc) { var addEvent = 'addEventListener', type = 'gesturestart', qsa = 'querySelectorAll', scales = [1, 1], meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; function fix() { meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; doc.removeEventListener(type, fix, true); } if ((meta = meta[meta.length - 1]) && addEvent in doc) { fix(); scales = [.25, 1.6]; doc[addEvent](type, fix, true); } };