PDA

View Full Version : Nova / Filters in Mobile View Question



Pete Young
December 28, 2020, 01:15 PM
In nova when using filters in mobile view you get the filter with a (+) button to open the filter up and when it id open there is a (-) negative button to close it. That is all good.

But where it bugs me is when you open the filters to select some filters options, after each selection it auto closes back up, so if you wanted to select say three filters, it is open, close, open, close, open, close, just to get the filter selections you want to use.

Is there I way I can turn off the auto-close after each filter selection and just allow people to select the (+) or (-) option at the top once they have selected the filters they wish to use?

Thanks.

Rudi
December 28, 2020, 03:34 PM
See this thread: https://forum.flynax.com/showthread.php?5361-Filter-box-at-mobile-size-display&highlight=filter

Pete Young
December 29, 2020, 12:19 AM
Hello Rudi that only changes the symbols shown on the filter, this does not stop the system updating everytime a filter is selected so you are still open, close, open, close, open, close so in effect that solution does not work.

I will do a quick video and post up here.

Please see Video Below. Thanks, Pete

In short, what we need it to do is update any filters chosen, but we do not then need it to auto-close, it should only close if we select the (-) button at the top after we select as many filters as we want below to avoid the multiple open and close.

https://screencast-o-matic.com/watch/cYlUcw88nE

Rudi
December 29, 2020, 09:37 AM
Hi Pete,

Ok, implemented on your end

Pete Young
December 29, 2020, 12:00 PM
Hi, Rudi at first I thought it was not working but I needed to clear the cache on my phone and it seems to be working now, thank you.

Would you be able to post the fix here as well, please?

Pete

Rudi
December 29, 2020, 06:20 PM
Yes, sure,

but this solution is only for the Category Filter boxes:

in lib.js find screen and (max-width: 767px)

and replace:


if ($('section.side_block > .expander').next().is(':visible')) {


with:


if ($('section.side_block > .expander').next().is(':visible') && !$('section.side_block').hasClass('categoryFilter' )) {



then find $.fn.tplToggle = function(options){

and replace below:


if (settings.id) {


with:


if (settings.id && !settings.cont.closest('section').hasClass('catego ryFilter')) {

Pete Young
December 29, 2020, 10:01 PM
Brilliant, thanks Rudi

Logmanov
August 24, 2021, 08:06 PM
Hi, Rudi!

I want filter opened block by clicking on + button to be closed by any click outside of this block, like user authorization block.
I need your help.
Look at the picture please:

4339

Rudi
August 25, 2021, 04:37 AM
Hello,

You can use this code:



$(document).bind('click touchstart', function(event){
var expander = $('section.categoryFilter .expander:not(.active)');

if (!$(event.target).parents().hasClass('categoryFilt er')
&& event.originalEvent !== undefined
&& expander.length > 0
)
{
expander.addClass('active');
expander.next().hide();
}
});

Logmanov
August 25, 2021, 07:44 AM
Thanks a lot Rudi!