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

Commit

Permalink
Fixed Header Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaz3e committed Jul 19, 2015
1 parent d2bf360 commit cca328b
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 124 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
####Create beautiful responsive Joomla templates more easier and faster.

[![S3Framework](http://img.shields.io/badge/S3Framework-Stable-blue.svg)](http://www.shaz3e.com)
[![Version](http://img.shields.io/badge/Version-3.5.2-green.svg)](http://www.shaz3e.com)
[![Version](http://img.shields.io/badge/Version-3.5.3-green.svg)](http://www.shaz3e.com)
[![Build Status](https://travis-ci.org/Shaz3e/S3-Joomla.png?branch=S3-Joomla)](https://travis-ci.org/Shaz3e/S3-Joomla)


Expand Down
121 changes: 1 addition & 120 deletions s3tools/s3_head.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,122 +29,6 @@
<?php } ?>

<jdoc:include type="head" />

<?php
/**
* Fixed header on scroll up/down slide up/down
* hide/show Header and Menu on scroll up/down
*
* @var string
* @since S3Framework 3.3
*/

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

/**
* Enable Height i.e. 100 (Fixed header will be hide after scrolling down 100px) at Joomla back-end/
*
* $var int
* @since S3Framework 3.3
*/
$sizeHeight = $this->params->get('fixedHeaderSize');

/**
* Define header ease slideUp/slideDown speed in ms default 400 in templateDetails.xml
*
* $var int
* @since S3Framework 3.3
*/
$duration = $this->params->get('fixedHeaderSpeed');

/**
* Break point fixed header will show on larger than break point devices as defined at Joomla back-end.
*
* $var int
* @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">
@media(min-width:<?php echo $breakPoint; ?>px){
body{padding-top:<?php echo $sizeHeight; ?>;}
.dc-fixed {
position: fixed;
top: 0px;
width:100%;
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; ?>){
$(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 // Less Development Mode
if($this->params->get('developmentMode')): ?>
<link rel="stylesheet/less" type="text/css" href="<?php echo $dcTemplatePath; ?>/themes/style<?php echo $this->params->get('style'); ?>/style.less">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.1/less.min.js"></script>
<?php if($this->params->get('LocalCDN')): ?>
<script type="text/javascript" src="<?php echo $dcTemplatePath; ?>/js/less.js"></script>
<?php else: ?>
<?php endif; ?>

<script type="text/javascript">
less.env = "development";
less.watch();
</script>
<?php endif; ?>

<?php
// Responsive Video
if($this->params->get('ResponsiveVideo')): ?>
Expand All @@ -156,7 +40,6 @@
</script>
<?php endif; ?>


<?php
// Google Analytics
if($this->params->get('analytics')): ?>
Expand All @@ -172,8 +55,6 @@
</script>
<?php endif; ?>



<link rel="shortcut icon" href="<?php echo $dcTemplatePath; ?>/images/favicon/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo $dcTemplatePath; ?>/images/favicon/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo $dcTemplatePath; ?>/images/favicon/apple-touch-icon-114x114.png">
Expand Down Expand Up @@ -201,4 +82,4 @@
<script type="text/javascript" src="<?php echo $dcTemplatePath; ?>/js/html5.js"></script>
<script type="text/javascript" src="<?php echo $dcTemplatePath; ?>/js/respond.js"></script>
<?php endif; ?>
<![endif]-->
<![endif]-->
122 changes: 122 additions & 0 deletions s3tools/s3_header_fixed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php
/*======================================================================*\
|| #################################################################### ||
|| # Package - Joomla Template based on Shaz3e S3 Framework ||
|| # Copyright (C) 2010 shaz3e.com. All Rights Reserved. ||
|| # Authors - Shahrukh A. Khan (Shaz3e) and DiligentCreators ||
|| # license - PHP files are licensed under GNU/GPL V2 ||
|| # license - CSS - JS - IMAGE files are Copyrighted material ||
|| # bound by Proprietary License of shaz3e.com ||
|| # for more information visit http://www.shaz3e.com/ ||
|| # Redistribution and modification of this software ||
|| # is bounded by its licenses websites - http://www.shaz3e.com ||
|| # A project of DiligentCreators - Construcing Ideas... ||
|| #################################################################### ||
\*======================================================================*/

// restricted access
defined('_JEXEC') or die;

/**
* Fixed header on scroll up/down slide up/down
* hide/show Header and Menu on scroll up/down
*
* @var string
* @since S3Framework 3.3
*/

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

/**
* Enable Height i.e. 100 (Fixed header will be hide after scrolling down 100px) at Joomla back-end/
*
* $var int
* @since S3Framework 3.3
*/
$sizeHeight = $this->params->get('fixedHeaderSize');

/**
* Define header ease slideUp/slideDown speed in ms default 400 in templateDetails.xml
*
* $var int
* @since S3Framework 3.3
*/
$duration = $this->params->get('fixedHeaderSpeed');

/**
* Break point fixed header will show on larger than break point devices as defined at Joomla back-end.
*
* $var int
* @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">
@media(min-width:<?php echo $breakPoint; ?>px){
.dc-fixed {
position:fixed;
margin:0 !important;
top:0;
display:block;
width:100%;
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 S3Header = $(window);
var S3HeaderPosition = S3Header.scrollTop();
var up = false;
var newscroll;

S3Header.scroll(function () {
newscroll = S3Header.scrollTop();
if (newscroll > S3HeaderPosition && !up && newscroll > <?php echo $sizeHeight; ?>) {
$('.dc-fixed-header').stop();
$('.dc-fixed-header').animate({top: '-100%'}, <?php echo $duration; ?>);
up = !up;
console.log(up);
} else if(newscroll < S3HeaderPosition && up) {
$('.dc-fixed-header').stop();
$('.dc-fixed-header').animate({top: '0px'}, <?php echo $duration; ?>);
up = !up;
}

S3HeaderPosition = newscroll;
});

var s3FixedHeader = $('.dc-fixed-header');
s3Fixed = "dc-fixed";
$(window).scroll(function() {
if( $(this).scrollTop()) {
s3FixedHeader.addClass(s3Fixed);
}else{
s3FixedHeader.removeClass(s3Fixed);
}
});
}
</script>

<?php endif; ?>
6 changes: 5 additions & 1 deletion s3tools/s3_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@
</footer>
<?php endif; ?>

<?php
<?php

// Show/Hide Scroll on Scroll Up/Down
include_once(JPATH_ROOT . "/templates/" . $this->template . "/s3tools/s3_header_fixed.php");

// copyright / credit / framework logo / style switch
include_once(JPATH_ROOT . "/templates/" . $this->template . "/blocks/credit.php");
?>
4 changes: 2 additions & 2 deletions templateDetails.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.0" type="template">
<name>S3Framework</name>
<version>3.5.1</version>
<version>3.5.3</version>
<creationDate>30 April 2014</creationDate>
<author>Team DC - Shaz3e</author>
<authorEmail>iam@shaz3e.com</authorEmail>
Expand Down Expand Up @@ -656,7 +656,7 @@

<field name="headerBackgroundColor" class="" type="color" default="#ffffff" label="Background Color" description="Header Background Color i.e. #ffffff" />

<field name="fixedHeaderSize" class="" type="text" default="150" label="Header Height" description="Change body top padding when using fixed header i.e. 150px" />
<field name="fixedHeaderSize" class="" type="text" default="200" label="Header Height" description="Change body top padding when using fixed header i.e. 200" />

<field name="fixedHeaderSpeed" class="" type="text" default="200" label="Ease Speed" description="Define header ease slideUp/slideDown speed in ms default 200" />

Expand Down

0 comments on commit cca328b

Please sign in to comment.