Skip Navigation

[Resolved] Styling distance feature: how to display on one line and only show km?

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by eloiseT 2 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2040375
Screen Shot 2021-05-03 at 2.56.07 pm.png

Tell us what you are trying to do?
The distance feature appears on four lines although there's plenty of space to fit on one line. I am trying to put it on one line.
Using CSS code, I have managed to remove the dropdown list to select the unit. However, I haven't managed to add "km" after the number using JS code.

Is there any documentation that you are following?
I used CSS and JS code from: https://toolset.com/forums/topic/styling-the-distance-feature-of-toolset-maps/

#2040567

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I tried to view your website, but it was password protected.

To troubleshoot, why the script isn't working and suggest the next steps, I'll need to see exactly how this distance filter is set up.

Can you please share temporary admin login details, along with the link to the page with this distance filter?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#2041405

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details.

I was able to make the distance search filter show in a single line, using these steps:

1. In the custom class field for the distance search filter block, I added a class "distance-search-block".
( screenshot: hidden link )

2. Next, to make the items in the distance search filter block, show in a single line, I included this CSS code in the view's "Custom CSS" section:
( screenshot: hidden link )


.distance-search-block .form-group .form-group {
display: inline-block;
}

.distance-search-block .js-toolset-maps-distance-center {
width: 43% !important;
}

3. And to append the 'km' text, I included this slightly updated script in the "Custom JS" section:


jQuery(document).ready(function(){
  jQuery('.js-toolset-maps-distance-unit').after('<span>km</span>');
});

#2042025

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.