Help pls

Vanish

Rising Java Developer
Dec 8, 2013
630
94
Can someone go to rscreativeboutique.com and tell me how do i do the Buttons thing where whenever i click a button, About button let's say, It changes to rscreativeboutique.com/about.html but stays on the same page. :)
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
It doesn't change pages, it scrolls down to the div

The nav:
HTML:
<a class="jumper" href="#whatever" data-soffset="0">Whatever</a>

The content:
HTML:
<section id="whatever">blah blah blah</section>

The JavaScript:
HTML:
$(document).ready(function() {
  $(".jumper").click(function() {
    var ScrollOffset = $(this).attr('data-soffset');
    $("html, body").animate({
      scrollTop: $($(this).attr("href")).offset().top-ScrollOffset + "px"
    }, {
      duration: 1500,
      easing: "swing"
    });
      return false;
  });
});
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
You could do something along the lines of this with PHP:

Index.php:
<?php
$page = /*validation stuff*/$_GET['page'];

if(isset($page)){
include 'pages/'.$page.'.html';
}else{
include 'pages/welcome.html';
}
?>
 

Vanish

Rising Java Developer
Dec 8, 2013
630
94
It doesn't change pages, it scrolls down to the div

The nav:
HTML:
<a class="jumper" href="#whatever" data-soffset="0">Whatever</a>

The content:
HTML:
<section id="whatever">blah blah blah</section>

The JavaScript:
HTML:
$(document).ready(function() {
  $(".jumper").click(function() {
    var ScrollOffset = $(this).attr('data-soffset');
    $("html, body").animate({
      scrollTop: $($(this).attr("href")).offset().top-ScrollOffset + "px"
    }, {
      duration: 1500,
      easing: "swing"
    });
      return false;
  });
});
Thanks for your time Teso. It worked.
 

Users who are viewing this thread

Top