Nandos Posted June 14, 2016 Share Posted June 14, 2016 (edited) Hi guys! Recently i added some custom parts (images and a script so far) to the footer, adding a new div and blablabla... What i want now is to not show some custom code if the site is opened in mobile version. How i can do that? That's the current code into footer.tpl file (default 1.6.1.5 theme) {* * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2016 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {if !isset($content_only) || !$content_only} </div><!-- #center_column --> {if isset($right_column_size) && !empty($right_column_size)} <div id="right_column" class="col-xs-12 col-sm-{$right_column_size|intval} column">{$HOOK_RIGHT_COLUMN}</div> {/if} </div><!-- .row --> </div><!-- #columns --> </div><!-- .columns-container --> {if isset($HOOK_FOOTER)} <!-- Footer --> <div class="footer-container"> <footer id="footer" class="container"> <div class="row">{$HOOK_FOOTER}</div> </footer> </div><!-- #footer --> {/if} </div><!-- #page --> {/if} {include file="$tpl_dir./global.tpl"} <!--Start of Tawk.to Script--> ---my tawk script code--- <!--End of Tawk.to Script--> <div class="container"> ---my custom code--- </div> </body> </html> Basically, i want to hide the last div class container i added at the end if the site is opened as mobile. That would be awesome! Thanks in advance, your help is always useful Edited June 17, 2016 by Nandos (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted June 15, 2016 Share Posted June 15, 2016 I suggest that you change <div class="container"> to <div class="container mobile-hidden"> and then add CSS code like the following to global.css: @media (max-width: 479px) { .mobile-hidden { display: none } } This should make it so the div is only displayed if the website width is 480px or above. You can adjust that value if needed. Link to comment Share on other sites More sharing options...
Nandos Posted June 15, 2016 Author Share Posted June 15, 2016 Thank you, looks it's working correctly so far It will be possible to make a check for mobile phones looking at browsers instead of resolution? Thanks in advance! Link to comment Share on other sites More sharing options...
rocky Posted June 16, 2016 Share Posted June 16, 2016 I found the following on line 430 of classes/FrontController.php on my PrestaShop v1.6.1.6 test site: 'mobile_device' => $this->context->getMobileDevice(), You could try using the following to check whether you're on a mobile device: {if $mobile_device}mobile{else}desktop{/if} 1 Link to comment Share on other sites More sharing options...
Nandos Posted June 17, 2016 Author Share Posted June 17, 2016 I found the following on line 430 of classes/FrontController.php on my PrestaShop v1.6.1.6 test site: 'mobile_device' => $this->context->getMobileDevice(), You could try using the following to check whether you're on a mobile device: {if $mobile_device}mobile{else}desktop{/if} I will try for sure, thanks a lot guys! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now