1 Reply Latest reply on May 31, 2017 8:40 AM by ryanrutan

    Hiding/revealing elements

    hen3ry

      In trying to develop a custom theme for Jive 9.0.0.1, I discovered something peculiar on the Search page. As is evident, selecting Content or People or Places hides the inapplicable option groups on that page, and shows the appropriate ones. The way it does this is very interesting: each option group <div> has a className of j-content, j-people or j-places. Selecting one of the radio buttons calls some JavaScript that has the line

       

      $('html').removeClass('j-content j-people j-places').addClass('j-' + facet);

       

      where facet is either "content", "people" or "places". This has the effect setting the CSS display value for all the option groups to "none", and then for the one selected value, changing it back to "block", thereby showing only the appropriate groups.

       

      Can somebody explain to me how this technique works? I've never seen it before, nor have any of my co-workers.

       

      Thanks.

        • Re: Hiding/revealing elements

          Unfortunately, I'm not quite sure how you would like this question to be answered.

           

          I would imagine there are CSS rules for the .j-content .j-people and .j-places defined on that page.  All that jQuery is doing is insuring that all CSS classes are removed and then adding the selected one back to insure that only one is selected at any time.

           

          I dont see anything peculiar about the snippet, per say, but I hope that helps.