• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Genesis Header jquery

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis Header jquery

This topic is: not resolved

Tagged: header, jquery, settings

  • This topic has 3 replies, 2 voices, and was last updated 9 years, 9 months ago by rfmeier.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • June 12, 2013 at 1:41 pm #45531
    brook1979
    Member

    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>

    June 12, 2013 at 2:20 pm #45543
    rfmeier
    Member

    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.


    Ryan Meier – Twitter

    June 12, 2013 at 2:26 pm #45545
    brook1979
    Member

    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

    June 12, 2013 at 2:40 pm #45550
    rfmeier
    Member

    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.


    Ryan Meier – Twitter

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble