Skip to content

Instantly share code, notes, and snippets.

@aqlong
Created March 14, 2011 20:57
Show Gist options
  • Save aqlong/869864 to your computer and use it in GitHub Desktop.
Save aqlong/869864 to your computer and use it in GitHub Desktop.
snippet for using different CSS based on if it's mobile or not
<!--- note the order of the CSS / JS files matters; thus, the sort of strange organization of code --->
<cfif attributes.includeJQueryMobile>
<cfif attributes.isMobileDevice>
<link rel="stylesheet" href="/css/jquery.mobile-1.0a3.min.css" type="text/css" />
</cfif>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<cfif attributes.isMobileDevice>
<script type="text/javascript" src="/js/jQuery/jquery.mobile.refynr-1.0a3.js"></script>
<script type="text/javascript" src="/js/jQuery/jquery.mobile-1.0a3.min.js"></script>
</cfif>
<cfelse>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</cfif>
<cfif attributes.isMobileDevice>
<cfset cssType = "mobile" />
<cfelse>
<cfset cssType = "desktop" />
</cfif>
<link rel="stylesheet" href="/css/myapp-#cssType#.1.0.css" type="text/css" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment