• Resolved wildflower24

    (@wildflower24)


    Hi there! Is there any way to set list view as default for member directory in mobile? I want to keep grid view as default for large screens.

    Thanks!

    • This topic was modified 4 years, 9 months ago by wildflower24.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @wildflower24

    You can try this javascript code snippet:

    jQuery(window).on("resize load", function() {
       jQuery(".um.um-directory").each(function() {
          element_width = jQuery(this).width();
    
          if (element_width <= 340) {
             jQuery("[data-type='list']").trigger("click");
          } else if (element_width <= 500) {
             jQuery("[data-type='list']").trigger("click");
          } else if (element_width <= 800) {
             jQuery("[data-type='list']").trigger("click");
          } else if (element_width <= 960) {
             jQuery("[data-type='grid']").trigger("click");
          } else if (element_width > 960) {
             jQuery("[data-type='grid']").trigger("click");
          }
          jQuery("[data-type='list']").trigger("mouseout");
          jQuery("[data-type='grid']").trigger("mouseout");
       });
    });
    

    You can add it to your theme scripts customizer. Or use this plugin to add the code to the footer or header( don’t forget to enclose it with <script></script> tags: https://ww.wp.xz.cn/plugins/insert-headers-and-footers/

    Regards,

    Thread Starter wildflower24

    (@wildflower24)

    Works like a charm! Thanks <3

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Member Directory: Set list view for mobile’ is closed to new replies.