Jump to content

Topic on Extension talk:MobileFrontend

How can I hide certain parts of the page only from mobile view of Mediawiki?

12
Happily8 (talkcontribs)

I am using MobileFrontEnd to generate the mobile view.

How can I hide certain elements from mobile view of Mediawiki?

Things like

<noinclude>content</noinclude>

will completely hide the content both from mobile view and desktop view,

but is there any code that will hide the content only from mobile view?

Nemo bis (talkcontribs)

You can use nomobile class, e.g. <span class="nomobile">hide this</span>. We also used to use noprint, but it was removed.

Happily8 (talkcontribs)

Thank you! Your answer helps me a lot. However it seems that there are two things. <span class="nomobile"> and <span class='nomobile'> Is there any difference between the two? Thank you again!

Nemo bis (talkcontribs)

Two things? I only see one, nomobile.

Happily8 (talkcontribs)

Oh I am sorry, I forgot to put nowiki tag when I put codes in the question. I fixed the question. Thank you!

Nemo bis (talkcontribs)

It's the same thing.

Happily8 (talkcontribs)

Thank you! I could check that the tag can hide texts from mobile view. However, it couldn't hide the whole table. I tried

<span class="nomobile"> {| class="wikitable mw-collapsible mw-collapsed" style="width: 50%;" |- ! title |- |dfsdf |- |}</span>

but it didn't hide the table from mobile. So instead I tried this

{| class="wikitable mw-collapsible mw-collapsed" |- !<span class="nomobile">blahblah</span> |- |<span class="nomobile">kk</span> |}

It worked. But isn't there any way to hide the whole table more simply?

Actually I decided to hide it because the table wasn't collapsed in the mobile. So if the question at https://www.mediawiki.org/wiki/Extension_talk:MobileFrontend#mw-collapsible_not_compatible_with_Mobilefrontend.3F_32385 is resolved, then I might not need <span class="nomobile"> in the first place :)

Edokter (talkcontribs)

You can't put a table inside a span; use <div class="nomobile">...</div> instead.

Blinkingline (talkcontribs)

Weird question, but is there a way to make parts of the main page only show up to Mobile view with a similar div class statement?

94.221.183.87 (talkcontribs)

class="mobileonly"

2001:1388:19:BB15:8995:D67F:7754:C714 (talkcontribs)

for show up on mobile only: mobileonly.

just on desktop view: nomobile

M.J.W.B. (talkcontribs)

Hi guys, I am trying to show an image on my page only on desktop, but hide it on mobile. I can't get it to work. I tried:

<span class="nomobile">[[File:MB.jpg|alt=Michael Beijer|thumb|Michael Beijer]]</span>  and  <div class="nomobile">[[File:MB.jpg|alt=Michael Beijer|thumb|Michael Beijer]]</div>

M.J.W.B. (talk) 21:50, 6 February 2024 (UTC)

Reply to "How can I hide certain parts of the page only from mobile view of Mediawiki?"