Commit b33dd391 authored by Leo Iannacone's avatar Leo Iannacone

added fixed sidebar [buggy]

parent d3f532aa
...@@ -3,6 +3,7 @@ function Page_Distrubion(socket) ...@@ -3,6 +3,7 @@ function Page_Distrubion(socket)
var socket = socket var socket = socket
var events = config.events.client var events = config.events.client
var data = Utils.from_hash_to_data() var data = Utils.from_hash_to_data()
var sidebarOffset = 0
function __check_hash_makes_sense() { function __check_hash_makes_sense() {
if (! window.location.hash) if (! window.location.hash)
...@@ -189,18 +190,30 @@ function Page_Distrubion(socket) ...@@ -189,18 +190,30 @@ function Page_Distrubion(socket)
} }
} }
// stiky sidebar // sticky sidebar
var sticky = function() { var sticky = {
// $(window).off("scroll")
// // back on top start: function() {
//// $("html, body").animate({scrollTop: 0}, 0); $(window).scroll(function() {
// var offset = $("#sticky").offset(); // FIXME: on load sidebarOffset is always 0 !!!
// $(window).scroll(function() { if (sidebarOffset == 0)
// if ($(window).scrollTop() > offset.top) return
// $("#sticky").stop().addClass('fixed'); if ($(window).scrollTop() > sidebarOffset) {
// else //console.log("sidebar.start -> adding: ", $(window).scrollTop(), sidebarOffset, $("#files").offset().top)
// $("#sticky").stop().removeClass('fixed'); $("#files").addClass('fixed')
// }) } else {
//console.log("sidebar.start -> remove: ", $(window).scrollTop(), sidebarOffset, $("#files").offset().top)
$("#files").removeClass('fixed')
}
})
},
reset: function() {
var sidebar = $("#files")
sidebarOffset = sidebar.offset().top
$(window).off("scroll")
sticky.start()
},
} }
var select = function() { var select = function() {
...@@ -265,7 +278,7 @@ function Page_Distrubion(socket) ...@@ -265,7 +278,7 @@ function Page_Distrubion(socket)
title.set() title.set()
breadcrumb.update() breadcrumb.update()
select() select()
sticky() sticky.reset()
} }
} }
...@@ -279,19 +292,19 @@ function Page_Distrubion(socket) ...@@ -279,19 +292,19 @@ function Page_Distrubion(socket)
this.start = function () { this.start = function () {
socket.on(events.distribution_packages.set, function(socket_data){ socket.on(events.distribution_packages.set, function (socket_data){
packages.set(socket_data) packages.set(socket_data)
}) })
socket.on(events.distribution_packages.status, function(socket_data){ socket.on(events.distribution_packages.status, function (socket_data){
packages.set_status(socket_data) packages.set_status(socket_data)
}) })
socket.on(config.events.broadcast.status_update, function(socket_data){ socket.on(config.events.broadcast.status_update, function (socket_data){
packages.set_status(socket_data) packages.set_status(socket_data)
}) })
socket.on(events.package_files_list.set, function(socket_data){ socket.on(events.package_files_list.set, function (socket_data){
files.set(socket_data) files.set(socket_data)
}) })
...@@ -299,7 +312,7 @@ function Page_Distrubion(socket) ...@@ -299,7 +312,7 @@ function Page_Distrubion(socket)
file.set(socket_data) file.set(socket_data)
}) })
socket.on(events.file_newcontent, function(socket_data) { socket.on(events.file_newcontent, function (socket_data) {
file.append(socket_data) file.append(socket_data)
}) })
......
.fixed {
position: fixed;
width: 220px !important;
top: 10px;
}
#header { #header {
background: url('../images/debian-logo.gif') right no-repeat; background: url('../images/debian-logo.gif') right no-repeat;
cursor: pointer; cursor: pointer;
...@@ -13,6 +7,17 @@ aside .nav-pills li { ...@@ -13,6 +7,17 @@ aside .nav-pills li {
line-height: 10px; line-height: 10px;
} }
#sidebar {
position: relative;
}
#sidebar .fixed {
position: fixed;
width: 220px !important;
top: 0;
}
footer { footer {
height: 40px; height: 40px;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</nav> </nav>
<article class="row"> <article class="row">
<aside class="col-md-3"> <aside id="sidebar" class="col-md-3">
<nav id="packages"> <nav id="packages">
<h2>Packages</h2> <h2>Packages</h2>
<ul class="nav nav-pills nav-stacked"></ul> <ul class="nav nav-pills nav-stacked"></ul>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment