]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blobdiff - static/js/site.js
add spacing and menu on mobile
[people/shoehn/ipfire.org.git] / static / js / site.js
index f8e535ccf98acc5a84b4a871d3a3381474a156fe..84521fb9807119afbf0f35664d3bb6659d5bc044 100644 (file)
@@ -1,3 +1,30 @@
+$(document).ready(function () {
+    $(window).scroll(function () {
+        if ($(document).scrollTop() > 100) {
+            $(".fixed-top").addClass("scrolled");
+            $(".menu-text").addClass("hidden");
+        } else {
+            $(".fixed-top").removeClass("scrolled");
+            $(".menu-text").removeClass("hidden");
+        }
+    });
+});
+
+//jQuery to collapse the navbar on scroll
+$(window).scroll(function() {
+       if ($(".navbar").offset().top > 50) {
+               $(".navbar-fixed-top").addClass("top-nav-collapse");
+       } else {
+               $(".navbar-fixed-top").removeClass("top-nav-collapse");
+       }
+});
+
+$("#scrollto").click(function() {
+    $('html, body').animate({
+        scrollTop: $("#features").offset().top - $('.fixed-top').height()
+    }, 1500, 'easeInOutExpo');
+});
+
 $.query = function(name){
        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
        return results[1] || 0;
@@ -14,7 +41,7 @@ var $window = $(window);
 
 $(".sidenav").affix({
        offset: {
-               top: function () { return $window.width() <= 980 ? 290 : 210 }
+               top: function () { return $window.width() <= 980 ? 290 : 240 }
                , bottom: 270
        }
 });
@@ -46,16 +73,15 @@ if (/.*download-splash.*/i.test(window.location.href)) {
        });
 }
 
-$(".planet-search-autocomplete").typeahead({
+/* $(".planet-search-autocomplete").typeahead({
        source: function(query, process) {
-               $.get("http://planet.ipfire.org/api/search/autocomplete", { q: query }, function(data) {
+               $.get("/api/planet/search/autocomplete", { q: query }, function(data) {
                        if (data.query == query) {
                                process(data.results);
                        }
                });
        },
-});
-
+}); */
 
 function getCookie(name) {
        var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");