1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Class for logged in vs not logged in?

Discussion in 'Styling and Customization Questions' started by Neil E., Oct 8, 2013.

  1. Neil E.

    Neil E. Active Member

    I have modified sidebar content that changes position when viewing the list of forum topics based on whether the user is logged in or not.

    My content is positioned correctly when logged in (top of sidebar level with top of main content). This is because the main content is moved down by the presence of pageNavLinkGroup. When not logged in, pageNavLinkGroup is gone and my sidebar looks too low because the main content moves up.

    CSS would be nice, but I doubt it exists:
    .forum_view .sidebar .loggedin
    {margin-top: 30px}


    .forum_view .sidebar .notloggedin
    {margin-top: 10px}


    How is this normally done?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The .LoggedIn class exists but it is JavaScript.

    Have you tried using a visitor conditional?
     
  3. Neil E.

    Neil E. Active Member

    I don't know how to do it. Doesn't a conditional just trigger events? Could it modify CSS?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This should work:

    Code:
    html.LoggedIn .forum_view .sidebar
    {
    	margin-top: 30px;
    }
    
    html.LoggedOut .forum_view .sidebar
    {
    	margin-top: 10px;
    }
    
     
  5. Neil E.

    Neil E. Active Member

    Jake is the greatest! So simple and elegant, works well, thank you.
     

Share This Page