Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript CSS DIV problem

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #207385
    bruce1969
    Participant

    I use the following code on my website to have smooth scrolling to sections of my website:

    $(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;
          }
        }
      });
    });
    

    If I try to use <a href="#faq">FAQ</a>, it only scrolls to the top of the page and doesn’t open the pop-up div for this link. Is there a way to work around this?

    #207391
    Shikkediel
    Participant

    I think some info is missing here, or it is otherwise unclear…

    #207392
    bruce1969
    Participant

    no info missing…

    If you use a code href=”#faq” to be used as a div pop-up, but the JS cancels this out, what would be the workaround?

    #207399
    nkrisc
    Participant

    What controlling the “pop-up”? Other JS? I don’t see that here but how are you sure that isn’t the issue?

    #207408
    bruce1969
    Participant

    It’s ok – I appreciate your effort, but this thread would go on and on and I would only end up getting frustrated.

    I created another solution, but I do thank you.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.