CC-1822 top menu bar stays in place.

This commit is contained in:
naomiaro 2011-01-30 23:05:49 -05:00
parent 629f6db6a4
commit ef48687385
5 changed files with 114 additions and 4 deletions

View File

@ -54,6 +54,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendFile('/js/libs/jquery-1.4.4.min.js','text/javascript');
$view->headScript()->appendFile('/js/libs/jquery-ui-1.8.8.custom.min.js','text/javascript');
$view->headScript()->appendFile('/js/libs/stuHover.js','text/javascript');
$view->headScript()->appendFile('/js/libs/jquery.stickyPanel.js','text/javascript');
$view->headScript()->appendFile('/js/airtime/common/common.js','text/javascript');
//TODO: Find better place to put this in.
$view->addHelperPath('../application/views/helpers', 'Airtime_View_Helper');

View File

@ -9,13 +9,15 @@
</head>
<body>
<div id="nowplayingbar"><?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())); ?></div>
<div class="logo"></div>
<div id="Panel">
<div class="logo"></div>
<?= $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
<?php $partial = array('menu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial); ?>
<?php echo $this->navigation()->menu() ?>
</div>
<div class="wrapper" id="content"><?php echo $this->layout()->content ?></div>
</body>

View File

@ -9,13 +9,15 @@
</head>
<body>
<div id="nowplayingbar"><?= $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?></div>
<div class="logo"></div>
<div id="Panel">
<div class="logo"></div>
<?= $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
<?php $partial = array('menu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial); ?>
<?php echo $this->navigation()->menu() ?>
</div>
<div class="wrapper">
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow alpha-block"><?php echo $this->layout()->spl ?></div>

View File

@ -0,0 +1,8 @@
$(document).ready(function() {
$("#Panel").stickyPanel({
topPadding: 1,
afterDetachCSSClass: "floated-panel",
savePanelSpace: true
});
});

View File

@ -0,0 +1,95 @@
/*
* jQuery.stickyPanel
* ----------------------
* version: 1.0.0
* date: 1/17/11
*
* Copyright (c) 2011 Donny Velazquez
* http://donnyvblog.blogspot.com/
* http://code.google.com/p/stickyPanel
*
* Licensed under the Apache License 2.0
*
*/
(function ($) {
$.fn.stickyPanel = function (options) {
var options = $.extend({}, $.fn.stickyPanel.defaults, options);
return this.each(function () {
$(window).bind("scroll.stickyPanel", { selected: $(this), options: options }, Scroll);
});
};
function Scroll(event) {
var node = event.data.selected;
var o = event.data.options;
// when top of window reaches the top of the panel detach
if ($(document).scrollTop() >= node.offset().top) {
// topPadding
var top = 0;
if (o.topPadding != "undefined") {
top = top + o.topPadding;
}
// save panels top
node.data("PanelsTop", node.offset().top - top);
// afterDetachCSSClass
if (o.afterDetachCSSClass != "") {
node.addClass(o.afterDetachCSSClass);
}
// savePanelSpace
if (o.savePanelSpace == true) {
var width = node.outerWidth(true);
var height = node.outerHeight(true);
var float = node.css("float");
var randomNum = Math.ceil(Math.random() * 9999); /* Pick random number between 1 and 9999 */
node.data("PanelSpaceID", "stickyPanelSpace" + randomNum);
node.before("<div id='" + node.data("PanelSpaceID") + "' style='width:" + width + "px;height:" + height + "px;float:" + float + ";'></div>");
}
// detach panel
node.css({
"top": top,
"position": "fixed"
});
}
if ($(document).scrollTop() <= node.data("PanelsTop")) {
if (o.savePanelSpace == true) {
$("#" + node.data("PanelSpaceID")).remove();
}
// attach panel
node.css({
"top": "auto",
"position": "static"
});
if (o.afterDetachCSSClass != "") {
node.removeClass(o.afterDetachCSSClass);
}
}
};
$.fn.stickyPanel.defaults = {
topPadding: 0,
// Use this to set the top margin of the detached panel.
afterDetachCSSClass: "",
// This class is applied when the panel detaches.
savePanelSpace: false
// When set to true the space where the panel was is kept open.
};
})(jQuery);