Difference between revisions of "Template:If mobile"

From blackwiki
Jump to navigation Jump to search
imported>Sdkb
(adding noincluded example, since this is potentially buggy)
imported>Sdkb
(Reverted to revision 995994298 by Sdkb (talk): Or maybe not? Sorry, I'm trying to figure out what's going on.)
Line 1: Line 1:
<templatestyles src="If mobile/styles.css" /><{{{tag|span}}} class="ifmobile"><{{{tag|span}}} class="nomobile"></{{{tag|span}}}><{{{tag|span}}} class="ifmobile-desktop">{{{2|<noinclude>Desktop</noinclude>}}}</{{{tag|span}}}><{{{tag|span}}} class="ifmobile-mobile">{{{1|<noinclude>Mobile</noinclude>}}}</{{{tag|span}}}></{{{tag|span}}}><noinclude>
+
<templatestyles src="If mobile/styles.css" /><{{{tag|{{{Tag|span}}}}}} class="ifmobile"><{{{tag|{{{Tag|span}}}}}} class="nomobile">{{{2|<noinclude>You are on desktop.</noinclude>}}}</{{{tag|{{{Tag|span}}}}}}><{{{tag|{{{Tag|span}}}}}} class="mobile">{{{1|<noinclude>You are on mobile.</noinclude>}}}</{{{tag|{{{Tag|span}}}}}}></{{{tag|{{{Tag|span}}}}}}><noinclude>
{{Documentation}}
+
{{Documentation}}</noinclude>
</noinclude>
 

Revision as of 23:51, 23 December 2020

You are on desktop.You are on mobile.

50px Template documentation[view] [edit] [history] [purge]

Script error: No such module "Uses TemplateStyles". This template detects whether it is being used on the mobile version of Wikipedia (en.m.wikipedia.org), and displays different content accordingly.

Rationale

Some features work differently on the mobile website, such as slideshow galleries appearing as ordinary galleries. This templates allows better presentation of such content, by e.g. having a "Slideshow" heading when a slideshow is shown, and a "Gallery" heading when a regular gallery is shown.

Usage

{{If mobile|content for mobile website|content for desktop website}}

By default, <span>...</span> tags are used to wrap the specified content. A different tag may be specified using |tag=

E.g. |tag=div can be used if the content contains block-level elements.

Example

{{If mobile|A mobile user you are!|You are looking at the desktop site}}