Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Chris Borgman

    (@chrisborgman)

    What I mean by “deactivate” is turning off the jquery scroll effect so the background reverts to just being a fixed or scrolling image.

    Works really great!!

    Thread Starter Chris Borgman

    (@chrisborgman)

    I tested again on my Android Moto G with Dolphin browser, the results are worse than on Chrome. The background image disappears as you scroll up.

    Anyone else tested on mobile devices?

    Thread Starter Chris Borgman

    (@chrisborgman)

    Thread Starter Chris Borgman

    (@chrisborgman)

    It took me awhile but I figured it out if anyone else can benefit from this simple hack. I altered the plugins core files so if it ever gets updated I’ll have to do this again.

    Download and install wp mobile detect plugin and add this to the SSJPB php file:

    $detect = new Mobile_Detect();
    if ( $detect->isMobile() ){}
    else

    So the end result looks like this:

    function super_simple_jquery_parallax_background_action() {
    
    				$detect = new Mobile_Detect();
    				if ( $detect->isMobile() ){}
    else
    
    // Any mobile device (phones or tablets).
        // Register and queue Javascript file.
        wp_register_script(
            'super_simple_jquery_parallax_background_js',
            // dirname(__FILE__)
            plugins_url('/assets/js/super-simple-jquery-parallax-background.js', __FILE__),
            array('jquery'), // Dependency.
            false, // Specific version, if exists.
            true // Enqueue for footer instead of head.
        );
        wp_enqueue_script('super_simple_jquery_parallax_background_js');
    }
    
    add_action('wp_enqueue_scripts', 'super_simple_jquery_parallax_background_action');

    If you want to kill parallax scrolling only on phones ONLY and not tablets use this instead:

    if( $detect->isMobile() && !$detect->isTablet() )

    The WP plugin is based on this: https://mobiledetect.net/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Deactivate for mobile -media query’ is closed to new replies.