forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: Sweetener on February 10, 2019, 01:29:00 pm

Title: Load script if not index.php
Post by: Sweetener on February 10, 2019, 01:29:00 pm
I want to load this:

Code: [Select]
<script>
$(document).ready(function () {
    $('html, body').animate({
        scrollTop: $('#scroll').offset().top
    }, 'slow');
});</script>

When its not the index, so the users can skip the header in desktop/mobile devices automatically.
Is there anyway to do that?
Title: Re: Load script if not index.php
Post by: ron4mac on February 10, 2019, 02:37:55 pm
Why not just don't show the header when the condition is met?

At any rate...
You could put this somewhere in the theme.php file of your theme:
Code: [Select]
if (basename($superCage->server->getRaw('PHP_SELF')) != 'index.php') {
  echo '
<script>
   $(document).ready(function () {
      $("html, body").animate({scrollTop: $("#scroll").offset().top}, "slow");
   });
</script>
';
}