Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Params Updated!
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaz3e committed Feb 22, 2015
1 parent 975cf4d commit e025721
Showing 1 changed file with 57 additions and 37 deletions.
94 changes: 57 additions & 37 deletions s3tools/s3_head.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<jdoc:include type="head" />

<?php

/**
* Fixed header on scroll up/down slide up/down
* hide/show Header and Menu on scroll up/down
Expand All @@ -41,7 +40,7 @@
*/

if($this->params->get('fixedHeader')):

/**
* Enable Height i.e. 100 (Fixed header will be hide after scrolling down 100px) at Joomla back-end/
*
Expand All @@ -65,50 +64,71 @@
* @since S3Framework 3.3
*/
$breakPoint = $this->params->get('breakPoint');

/**
* Text Colors for fixed header as defined at Joomla back-end.
*
* $var string
* @since S3Framework 3.4.1
*/
$headerTextColor = $this->params->get('headerTextColor');

/**
* Background Colors for fixed header as defined at Joomla back-end.
*
* $var string
* @since S3Framework 3.4.1
*/
$headerBackgroundColor = $this->params->get('headerBackgroundColor');

?>

<style type="text/css">
/* Fixed Header which works on scroll up/down */
@media (min-width: <?php echo $breakPoint; ?>px) {
.dc-fixed{position:fixed;}
.dc-fixed-header{
margin:0 !important;
top:0;
display:block;
@media(min-width:<?php echo $breakPoint; ?>px){
body{padding-top:<?php echo $sizeHeight; ?>;}
.dc-fixed {
position: fixed;
top: 0px;
width:100%;
z-index:99999999;
z-index:99;
<?php if($this->params->get('headerTextColor')){echo 'color:'. $headerTextColor .';';} ?>
<?php if($this->params->get('headerBackgroundColor')){echo 'background-color:'. $headerBackgroundColor .';';} ?>
}
}
</style>

<script type="text/javascript">
if (document.documentElement.clientWidth >= <?php echo $breakPoint; ?> || screen.width >= <?php echo $breakPoint; ?>){
var dcHeader = $(window);
var dcHeaderPosition = dcHeader.scrollTop();
var up = false;
var newscroll;
dcHeader.scroll(function () {
newscroll = dcHeader.scrollTop();
if (newscroll > dcHeaderPosition && !up && newscroll > <?php echo $sizeHeight; ?>) {
$('.dc-fixed-header').stop().slideUp({duration:<?php echo $duration; ?>});
up = !up;
console.log(up);
} else if(newscroll < dcHeaderPosition && up) {
$('.dc-fixed-header').stop().slideDown({duration:<?php echo $duration; ?>});
up = !up;
}
dcHeaderPosition = newscroll;
});

$(window).scroll(function() {
if( $(this).scrollTop()) {
$('.dc-fixed-header').addClass('dc-fixed');
}else{
$('.dc-fixed-header').removeClass('dc-fixed');
}
});
}
if (document.documentElement.clientWidth >= <?php echo $breakPoint; ?> || screen.width >= <?php echo $breakPoint; ?>){
$(function(){
var prevScroll = 0,
curDir = 'down',
prevDir = 'up';

$(window).scroll(function(){
if($(this).scrollTop() >= prevScroll){
curDir = 'down';
if(curDir != prevDir){
$('.dc-fixed').stop();
$('.dc-fixed').animate({ top: '-100%' }, <?php echo $duration; ?>);
prevDir = curDir;
}
} else {
curDir = 'up';

if(curDir != prevDir){
$('.dc-fixed').stop();
$('.dc-fixed').animate({ top: '0px' }, <?php echo $duration; ?>);
prevDir = curDir;
}
}

prevScroll = $(this).scrollTop();
});
})
}
</script>
<?php endif; ?>

<?php endif; ?>

<?php // Less Development Mode
if($this->params->get('developmentMode')): ?>
Expand Down

0 comments on commit e025721

Please sign in to comment.