Disable Scrollwheel on gd_add_listing page map

This topic contains 4 replies, has 3 voices, and was last updated by  Timothy Sullivan 4 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #499894

    Timothy Sullivan
    Buyer
    Post count: 63

    Hi,
    On the add-listing page, how do we turn OFF the scrolling zoom on the google map that appears there.

    [gd_add_listing] shortcode doesn’t seem to have any setting to control the behavior of the map scrolling/zoom.

    thanks

    #499895

    Timothy Sullivan
    Buyer
    Post count: 63
    This reply has been marked as private.
    #499896

    Guust
    Moderator
    Post count: 29970

    I’ll get the developers to have a look at your question after the weekend.
    Thanks

    #500083

    Kiran
    Moderator
    Post count: 7069

    Hi Timothy,

    I have added following PHP snippet at “Snippets > GeoDirectory: add listing map controls” to manage map controls.

    
    
    /**
     * Filter the add listing map arguments.
     */
    function gd_snippet_190729_template_render_map_js_params() {
    	$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : NULL;
    	$screen_id = $screen ? $screen->id : '';
    
    	if ( ! ( $screen_id && geodir_is_gd_post_type( $screen_id ) || geodir_is_page( 'add-listing' ) ) ) {
    		return;
    	}
    
    	$params = array();
    	//$params[] = "maptype: 'ROADMAP'"; 			// Map type (ex: HYBRID, ROADMAP, SATELLITE, TERRAIN)
    	//$params[] = "zoom: 10"; 					// Default zoom (ex: 12).
    	$params[] = "scrollwheel: false"; 			// Mouse scroll (ex: true or false).
    	//$params[] = "streetViewControl: false"; 	// Street view control (ex: true or false).
    
    	if ( ! empty( $params ) ) {
    		echo implode( ',', $params ) . ',';
    	}
    }
    add_filter( 'geodir_template_render_map_js_params', 'gd_snippet_190729_template_render_map_js_params' , 20, 1 );

    Please check and let us know.

    Regards,
    Kiran

    #500185

    Timothy Sullivan
    Buyer
    Post count: 63

    Works great. Thanks Kiran!

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket