• 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

Modern Portfolio Pro – Scrolling

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 › General Discussion › Modern Portfolio Pro – Scrolling

This topic is: not resolved

Tagged: Modern Portfolio Pro, scroll

  • This topic has 7 replies, 2 voices, and was last updated 9 years, 9 months ago by pagerank.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • April 10, 2016 at 12:00 pm #183286
    pagerank
    Participant

    I am using Modern Portfolio Pro. I have added the smooth scrolling capability to a page by adding the following

    <script type='text/javascript' src='/wp-content/themes/modern-portfolio-pro/js/jquery.scrollTo.min.js?ver=1f5377270e80de4af718712f3afaf586-beta'></script>
    <script type='text/javascript' src='/wp-content/themes/modern-portfolio-pro/js/jquery.localScroll.min.js?ver=1f5377270e80de4af718712f3afaf586b'></script>
    <script type='text/javascript' src='/wp-content/themes/modern-portfolio-pro/js/scroll.js?ver=1f5377270e80de4af718712f3afaf586'></script>
    <script type='text/javascript' src='/wp-includes/js/wp-embed.min.js?ver=1f5377270e80de4af718712f3afaf586'></script>

    It works fine when viewed on a desktop screen. However, when viewing the page on a tablet, it scrolls down to the section ID, and then it bounces back up part way. Is there a way to fix this? Or, is it possible to enqueue these scripts only when the desktop screen is being used?

    Thanks,
    Chris

    April 10, 2016 at 12:04 pm #183290
    Christoph
    Member

    Hi Chris,

    you can enqueue the scripts conditionally with wp_is_mobile()
    https://codex.wordpress.org/Function_Reference/wp_is_mobile

    If you need more control, you could use a plugin called Mobble.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    April 10, 2016 at 12:24 pm #183293
    pagerank
    Participant

    Hi Christoph,

    Thanks for that! For my situation (only enqueue for desktop), would I need to use wp_dequeue_script to remove the scripts from mobile?

    Chris

    April 10, 2016 at 12:27 pm #183294
    Christoph
    Member

    Hi Chris,

    you are welcome.

    No, you would only enqueue the scripts if it´s not mobile.
    if (! wp_is_mobile) {
    ...
    }


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    April 10, 2016 at 12:35 pm #183295
    pagerank
    Participant

    Palm to forehead ... Thanks 🙂

    April 10, 2016 at 12:45 pm #183296
    pagerank
    Participant

    My palm is still beating my forehead ...

    Could you please have a look at the following code and let me know where I'm going wrong?

    if ( !wp_is_mobile() && is_page(507) ) {
    function wpdocs_theme_name_scripts() {
       wp_enqueue_script( 'custom-script', '/wp-content/themes/modern-portfolio-pro/js/jquery.scrollTo.min.js?ver=1f5377270e80de4af718712f3afaf586-beta', array( 'jquery' ) );
       wp_enqueue_script( 'custom-script', '/wp-content/themes/modern-portfolio-pro/js/jquery.localScroll.min.js?ver=1f5377270e80de4af718712f3afaf586b', array( 'jquery' ) );
       wp_enqueue_script( 'custom-script', '/wp-content/themes/modern-portfolio-pro/js/scroll.js?ver=1f5377270e80de4af718712f3afaf586', array( 'jquery' ) );
       wp_enqueue_script( 'custom-script', '/wp-includes/js/wp-embed.min.js?ver=1f5377270e80de4af718712f3afaf586', array( 'jquery' ) );
    }
    add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

    I have tried removing
    , array('jquery')
    'custom-script',

    Neither worked. As you can see, I'm not a coder, just a tinkerer. Any help would be greatly appreciated.
    Chris

    April 10, 2016 at 2:03 pm #183305
    Christoph
    Member

    Hi,

    I haven't tested the code but this looks better:

    function wpdocs_theme_name_scripts() {
    	if ( !wp_is_mobile() && is_page(507) ) {
       		wp_enqueue_script( 'custom-script', '/wp-content/themes/modern-portfolio-pro/js/jquery.scrollTo.min.js?ver=1f5377270e80de4af718712f3afaf586-beta', array( 'jquery' ) );
       		wp_enqueue_script( 'custom-script', '/wp-content/themes/modern-portfolio-pro/js/jquery.localScroll.min.js?ver=1f5377270e80de4af718712f3afaf586b', array( 'jquery' ) );
       		wp_enqueue_script( 'custom-script', '/wp-content/themes/modern-portfolio-pro/js/scroll.js?ver=1f5377270e80de4af718712f3afaf586', array( 'jquery' ) );
       		wp_enqueue_script( 'custom-script', '/wp-includes/js/wp-embed.min.js?ver=1f5377270e80de4af718712f3afaf586', array( 'jquery' ) );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    April 10, 2016 at 3:04 pm #183310
    pagerank
    Participant

    Thanks again for your help! I eventually figured out how to do it a) using Genesis Extender and b) installing the plugin "Mobble" provided at the bottom of the WordPress.org link you sent me. Here's the direct link if anyone else needs it - https://github.com/scottsweb/mobble

    Thanks again!

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘General Discussion’ 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

© 2026 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