Hide footer on mobile and tablet
I want to hide my footer on mobile and tablet devices. I have searched all the help but found nothing. HTML code for my footer,
<!-- Footer -->
<footer class="footer" role="contentinfo">
<div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
<jdoc:include type="modules" name="footer" style="none" />
<div class="footer">
© <?php echo date('Y'); ?> <?php echo $sitename; ?>
</div>
CSS code for my footer,
.footer {
background-color: #F6861F;
color: #fff;
padding: 20px 0;
margin-bottom: 0
text-align: center;
overflow: hidden;
width: 100%;
}
source to share
After the first mobile strategy, you must first hide the footer and then show it only for desktops.
.footer {
display: none;
}
@media (min-width: 992px) {
.footer {
display: block;
background-color: #F6861F;
color: #fff;
padding: 20px 0;
margin-bottom: 0
text-align: center;
overflow: hidden;
width: 100%;
}
}
source to share
Check out this jsfiddle http://jsfiddle.net/ks1q8nkt/
@media screen and (max-width: 600px) {
.footer{
display: none;
}
}
The code means that every class, id and element that is defined in the block will be responsible for all devices with a maximum width of 600 pixels.
source to share
Use CSS from other people. Alternatively, if you are using the Bootstrap framework (baked in most Joomla templates), just add the appropriate column visibility classes:
<!-- Footer -->
<footer class="footer" role="contentinfo">
<div class="hidden-xs hidden-sm container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
<jdoc:include type="modules" name="footer" style="none" />
<div class="footer">
© <?php echo date('Y'); ?> <?php echo $sitename; ?>
</div>
</div>
</footer>
I added hidden-xs and hidden-sm to the class list div
in front of the container. See here: Bootstrap Helper Utilities
NOTE. These two classes are from the most recent version of Bootstrap. For version 2.3.2, you should read here: Bootstrap v2.3.2 Responsive Utilities
source to share