Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Load script if not index.php  (Read 6453 times)

0 Members and 1 Guest are viewing this topic.

Sweetener

  • Contributor
  • Coppermine regular visitor
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 64
Load script if not index.php
« 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?

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: Load script if not index.php
« Reply #1 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>
';
}
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.