Jump to content

Increase avatar size on desktop but not mobile?


Recommended Posts

Hello,

forum: http://www.jwfan.com/forums

On IPBoard 4.4, we had this in our custom.css that made avatars display bigger in desktop, and this didn't affect mobile

    .ipsUserPhoto_large img, img.ipsUserPhoto_large, .ipsUserPhoto_large:after {
        width: 120px;
        height: 120px;
        {{if theme.rounded_photos}}
            border-radius: 45px;
        {{endif}}
    }

 

If I put this same code into the custom.css of our (default) theme now that we're on IPBoard 4.5., the avatars look fine on desktop (well, almost fine, the badges for admins are off-center) but it completely breaks the mobile view

 

Screenshot_20201025-113008_Firefox.jpg

Does anybody know what CSS I can use to affect desktop avatar size only but leave mobile CSS alone?

 

Maybe some kind of if statement that determines if the parent is "cAuthorPane_info" vs "cAuthorPane_mobile" ?

Link to comment
Share on other sites

WOOP nevermind, I just figured it out

If anyone else wants to do the same,

 

In Forums/Topics/postContainer, change this:

 

			<li data-role='photo' class='cAuthorPane_photo'>
				{template="userPhoto" app="core" group="global" params="$comment->author(), 'large', $comment->warningRef()"}
				{{if $comment->author()->modShowBadge()}}
				<span class="cAuthorPane_badge cAuthorPane_badge--moderator" data-ipsTooltip title="{lang="member_is_moderator" sprintf="$comment->author()->name"}"></span>
				{{elseif $comment->author()->joinedRecently()}}
				<span class="cAuthorPane_badge cAuthorPane_badge--new" data-ipsTooltip title="{lang="member_is_new_badge" sprintf="$comment->author()->name"}"></span>
				{{endif}}
			</li>

to this:

			<li data-role='photo' class='cAuthorPane_photo'>
				{{if $comment->author()->pp_main_photo AND $comment->author()->pp_thumb_photo}}
              <img src="{url="" base=""}/uploads/{$comment->author()->pp_main_photo}">
              {{else}}
              <img src="{$comment->author()->photo}">
              {{endif}}
				{{if $comment->author()->modShowBadge()}}
				<span class="cAuthorPane_badge cAuthorPane_badge--moderator" data-ipsTooltip title="{lang="member_is_moderator" sprintf="$comment->author()->name"}"></span>
				{{elseif $comment->author()->joinedRecently()}}
				<span class="cAuthorPane_badge cAuthorPane_badge--new" data-ipsTooltip title="{lang="member_is_new_badge" sprintf="$comment->author()->name"}"></span>
				{{endif}}
			</li>

And in custom.css add this:

.cAuthorPane_photo img {
    max-width: 170px;
    width: auto;
}

 

Edited by AndreasW
Link to comment
Share on other sites

Your way's not necessarily wrong if it works for you but it seems a lot more complex than it needs to be, and amending the templates themselves is usually a last-ditch solution.

It seems to me that you can solve the problem easily with one entry in custom.css:

@media (min-width:992px){
  .ipsUserPhoto_large {
  	height: yourheight;
  	width: yourwidth;
	}
}

This will apply throughout the suite so if it's important to hit only Forums but leave other instances of the large photo unchanged, you could try a more specific way of targeting, such as:

body[data-pageapp="forums"] @media (min-width:992px){
	.ipsUserPhoto_large {
  		height: yourheight;
  		width: yourwidth;
	}
}

OnPaste.20201029-092020.jpg.5ad391b9f1e05cb901aa2a8a1daca972.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...