<header id="rt-top-surround" class="animated scrollheader slideDown">
<div id="rt-top">...</div>
<div id="rt-header">...</div>
<div id="rt-fullwidth">
<div class="custom rt-kmenu-surround">...</div>
<div class="clear"></div>
</div>
</header>
<header id="rt-top-surround" class="animated scrollheader slideUp">
/* rt-header-surround */
.kunena #rt-header-surround {
height: 160px;
}
#rt-header-surround {
height: 120px;
background-color: #E5E5E5;
}
/* rt-top-surround class=animated scrollheader slideDown/slideUp */
#rt-top-surround.animated.slideDown {
-webkit-animation-name: slideDown;
-moz-animation-name: slideDown;
animation-name: slideDown;
}
#rt-top-surround.animated.slideUp {
-webkit-animation-name: slideUp;
-moz-animation-name: slideUp;
animation-name: slideUp;
}
#rt-top-surround.animated {
-webkit-animation-duration: .5s;
-moz-animation-duration: .5s;
animation-duration: .5s;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
animation-fill-mode: both;
}
.kunena #rt-top-surround {
border-bottom: 1px solid #ccc;
box-shadow: none;
}
#rt-top-surround {
background-color: #2b2f35;
color: #F0F0F0;
position: fixed;
z-index: 1000;
right: 0;
left: 0;
top: 0;
box-shadow: 0 1px 6px rgba(0,0,0,.4);
}
.animated.slideDown {
-webkit-animation-name: slideDown;
-moz-animation-name: slideDown;
-o-animation-name: slideDown;
animation-name: slideDown;
}
<head>
.
.
.
<script src="/media/jui/js/jquery.min.js" type="text/javascript"></script>
<script src="/media/jui/js/jquery-noconflict.js" type="text/javascript"></script>
<script src="/media/jui/js/jquery-migrate.min.js" type="text/javascript"></script>
.
.
.
</head>
.
.
.
<div id="rt-showcase" style="position: relative; left: 0px; top: 0px; margin-left: 0px;">
<div class="rt-showcase-pattern">
<div class="rt-container">
<div class="rt-grid-12 rt-alpha rt-omega">
<div class="rt-block menu-block">
<div class="clear"></div>
<ul class="gf-menu l1 ">
<li class="item101 active last">...</li>
</ul>
</div>
</div>
</div>
</div>
</div>
.
.
.
<?php /** Begin Popup **/
echo $gantry->displayModules('login','login','login');
/** End Popup **/ ?>
<!-- inserted floating div code -->
<script type="text/javascript">
//avoid conflict with other script
$j=jQuery.noConflict();
$j(document).ready(function($) {
//this is the floating content
var $floatingDiv = $('#rt-showcase');
var $mainContent = $('#rt-mainbody-surround');
if($($mainContent).length > 0){
var mainContentY = parseInt($($mainContent).offset().top) -40;
var originalX = $floatingDiv.css('margin-left');
$(window).scroll(function () {
var scrollY = $(window).scrollTop();
var isfixed = $floatingDiv.css('position') == 'fixed';
if($floatingDiv.length > 0) {
//$floatingDiv.html(" srollY : " + scrollY + ", mainContentY : " + mainContentY + ", isfixed : " + isfixed );
//the above line is for testing purposes - it will overwrite any content in the div as soon as you scroll if uncommented
if ( scrollY > mainContentY && !isfixed ) {
$floatingDiv.stop().css({
position: 'fixed',
left: 0,
top: 0,
marginLeft: 'auto'
});
} else if ( scrollY < mainContentY && isfixed ) {
$floatingDiv.css({
position: 'relative',
left: 0,
top: 0,
marginLeft: originalX
});
}
}
});
}
});
</script>
<!-- end floating div code -->
</body>
</html>
<?php
$gantry->finalize();
?>
#rt-showcase {
height: 41px;
position: relative;
z-index: 99;
width: 100%;
}
Time to create page: 0.093 seconds