Genesis Header jquery

Community Forums Forums Design Tips and Tricks Genesis Header jquery

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  rfmeier 1 year, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45531

    brook1979
    Participant
    Post count: 41

    Hi People,

    Wondering if someone could help find a solution to my problem, Im using the below code which I placed into genesis header settings on the theme settings page to make page anchors scroll. Ive checked with firebug and can see the jquery is loading, but the scroll effect isn’t working and still continues to jump.

    Anyone have any pointers or advice for this?? I don’t really want to use a plugin for a few lines of code if that makes sense.

    Thanks in advance.
    <script type=”text/javascript”>
    jQuery(function() {
    //catch all clicks on a tags
    jQuery(“a”).click(function(){
    //check if it has a hash (i.e. if it’s an anchor link)
    if(this.hash){
    var hash = this.hash.substr(1);
    var $toElement = jQuery(“[id="+hash+"]“);
    var toPosition = $toElement.position().top;
    //scroll to element
    jQuery(“body,html”).animate({
    scrollTop : toPosition
    },2000,”easeOutExpo”)
    }
    });
    //do the same with urls with hash too (so on page load it will slide nicely)
    if(location.hash){
    var hash = location.hash;
    window.scroll(0,0);
    jQuery(“a[href=”+hash+”).click();
    }
    });
    </script>

    #45543

    rfmeier
    Participant
    Post count: 597

    Hello,

    Is this page live?  Would a link be possible?  Also, try putting this within the footer section instead of the header on the settings page.


    #45545

    brook1979
    Participant
    Post count: 41

    Hi rfmeier,

    Not live rfmeier, I tried it in the footer but still the same results! :(

    I even have some other jquery code for logins etc and thought that maybe conflicting so i removed that and still the same results.

    Any ideas

    Cheers for dropping in, much appreciated.

    Brook

    #45550

    rfmeier
    Participant
    Post count: 597

    Brook,

    Is the browser throwing any javascript errors when you click on a link that should be scrolling? I am not sure if it is the message boards stripping characters, but the javascript code seems to have some errors.


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.