I am trying to make the smooth scroll effects with this basic script for this site: http://greaca9.ro/test/index.html

$(function() {
  $('a[href*="#"]:not([href="#"])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html, body').animate({
          scrollTop: target.offset().top
        }, 1000);
        return false;

The problem is that it doesn't fire up when I click a link ('APASA' right under the video background) to scroll me lower on the page. I found out that the issue comes out from this part of the style.css:

.box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;

How can I make it work or change it to a workaround!?

1 Year
Discussion Span
Last Post by panduranga_1

Looking at the source of your HTML, I don't see the sections with the ID you want to scroll to.
If you have for example this:

<a href="#featured"><i class="glyphicon glyphicon-list-alt"></i> Despre Mine</a>

Then you should have further down the HTML an element with that ID like so:

<section id="featured">
    <p>Featured content etc.</p>

Edited by gentlemedia


Yeah I removed the former button. It;s just an inconvenience but other than that I will manage without this eefect for now :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.