Visit Our UNIX and Linux User Community

The Lounge What is on Your Mind? JQuery and CSS Flex Code for Responsive Forum Home Page Post 303021499 by Neo on Saturday 11th of August 2018 02:46:28 AM
Old 08-11-2018
JQuery and CSS Flex Code for Responsive Forum Home Page

So far, I have completed making the home page more responsive (except for the forum stats at the top and the WOL box at the bottom, they still use scroll bars).



For full screen use the link below and set your YT resolution to 1080p60 HD

Code:
https://youtu.be/xevV3_iZ8-s

Here is the jQuery code I wrote to make the forumhome table more responsive using CSS Flex:

Code:
<script>
    jQuery(document).ready(function () {
        jQuery('[class^="forumhome_forumbit_level"]').
            css({
                "display": "flex", "flex-flow": "row wrap",
                "justify-content": "space-between",
                "flex-direction": "row", "align-content": "stretch",
                "margin": "0px", "padding": "0px"
            });
        jQuery('[class^="forumhome_forumbit_level"]').closest("div").
            css({ "overflow": "visible" });
        jQuery('[class^="forumhome_forumbit_level"]').find("td").
            css({
                "align-self": "stretch",
                "flex-grow": "1", "width": "300"
            });
        jQuery('[class^="forumhome_forumbit_level"]').find(".neo-forumhome-status").
            css({
                "flex-grow": "1", "width": "80"
            });
        jQuery('[class^="forumhome_forumbit_level"]').find(".neo-forumhome-status-icon").
            css({
                "flex-grow": "1", "width": "60"
            });
        jQuery('[class^="forumhome_forumbit_level"]').find(".neo-forumhome-postinfo").
            css({
                "flex-grow": "20"
            });
        jQuery('[class^="forumhome_forumbit_level"]').find(".neo-forumhome-desc").
            css({
                "flex-grow": "20"
            });
        jQuery('.neo-forumhome-div').find("tbody").
            css({
                "margin": "0px", "padding": "0px",
                "border-style": "none", "border-width": "0px"
            });
        $(window).on('resize', neoAdjustForums);
        neoAdjustForums();
        function neoAdjustForums() {
            var widthNow = $(window).width();
            if (widthNow < 900) {
                $(".forumhome_forumbit_level_thead").hide();

            }
            else {
                $(".forumhome_forumbit_level_thead").show();
            }
            if (widthNow < 810) {
                $(".neo-forumhome-status-icon").hide();
            }
            else {
                $(".neo-forumhome-status-icon").show();
            }
            if (widthNow < 550) {
                $(".neo-forumhome-postinfo, .neo-forumhome-subforums").hide();
            }
            else {
                $(".neo-forumhome-postinfo, .neo-forumhome-subforums").show();
            }
            if (widthNow < 575) {
                $(".neo-forumbit-viewing").hide();
            }
            else {
                $(".neo-forumbit-viewing").show();
            }
        }
    });
</script>

Please post comments or suggestions on this here. Thanks.
 
Test Your Knowledge in Computers #443
Difficulty: Easy
FHM, a men's lifestyle magazine, asked 1,344 women if they preferred to hang out with a computer science expert or a footballer, and 1,023 (76.116%) stated they preferred geeks over athletes.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need to know best forum site for flex code

Hi All, Please help me to know the similar forum site but for the flex code. Thanks (6 Replies)
Discussion started by: aish11
6 Replies

2. What is on Your Mind?

Forum Update: Disabled Home Page Forum Statistics for Guests (Not Registered)

Just a quick update; to speed up the forums, I have disabled the forum statistics on the home page for non registered users. No changes for registered users. (0 Replies)
Discussion started by: Neo
0 Replies

3. What is on Your Mind?

Man Page Repositories - Added jQuery and Bootstrap

I added both jQuery and Bootstrap Javacript libs to all man page repository pages. TODO: I need to add pagination to these repos because most are very large and load to slow on a single page. For the first upgrade, I manually added one new CSS Class (repository) to the main repo tables and... (0 Replies)
Discussion started by: Neo
0 Replies

4. What is on Your Mind?

Forum Description Animation with jQuery

I found that the pages that lists all the forums were too cluttered with the forum descriptions, so I added a bit of jQuery to hide the forum descriptions and to fade them in and out on mouseover: <script> $(document).ready(function() { jQuery(".neo-forum-description").hide();... (2 Replies)
Discussion started by: Neo
2 Replies

5. What is on Your Mind?

JQuery and CSS Flex Code for Responsive WOL Page

I have just wrote this jQuery to the WOL page, so the table of users on line will not need scrollbars and will instead transform into a responsive table: <script> jQuery(document).ready(function (){ jQuery("#neo-who-flex-tcat"). css({"display":"flex","flex-flow":"row wrap", ... (0 Replies)
Discussion started by: Neo
0 Replies

6. Web Development

PHP Changes to WOL for New Forum Home Page

Wrote some PHP code today to make the Who Is Online (WOL) in the forums work properly with the new home page: Wrote this global plugin to add the location to both the user table (for members) and session table (for guests + registered users) <?php if (THIS_SCRIPT != 'misc' and... (0 Replies)
Discussion started by: Neo
0 Replies

7. Web Development

New Supplementary CSS for Forum Postbit

Working on moving inline style to a supplementary CSS file. This one is postbit.css: .pb-wrapper { border-style: solid; border-width: 1px; border-color: rgba(110, 117, 182, 0.99); padding: 0px 0px 0px 0px; } .pb-wrapper-b { padding: 0px; border-width: 0px 0px 1px... (0 Replies)
Discussion started by: Neo
0 Replies

8. What is on Your Mind?

New Responsive 404 Page for UNIX.com

Just created (actually, only modified... it was created by ShoutOut) a new responsive 404 "not found" page with the help of ShoutOut free templates. https://www.unix.com/status/404.html Same for 401 and 403 errors. Picture sans animation: ... (2 Replies)
Discussion started by: Neo
2 Replies

9. What is on Your Mind?

Mobile: Advanced Forum Statistics to Forum Home Page

For mobile users, I have just added a "first beta" Advanced Forum Statistics to the home page on mobile using CSS overflow:auto; so you can swipe if you need to see more. Google Search Console mobile usability says this page is "mobile friendly" so perhaps this will be useful for some of our... (12 Replies)
Discussion started by: Neo
12 Replies

Featured Tech Videos

All times are GMT -4. The time now is 07:55 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy