vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Different Style for certain resolutions (https://vborg.vbsupport.ru/showthread.php?t=276730)

Wakey 01-10-2012 11:33 AM

Different Style for certain resolutions
 
I have a style that doesn't work too well on an iPad or other smaller screen device so I would like to have an adjusted style with some elements removed for screens equal to or under 1024x768.

I have a cookie created that lasts an hour using Javascript in my headers so the forum can get access to the resolution (I would have done it via a plugin but I don't believe you can run Javascript in a plugin) and I currently have the sidebar disabled on smaller screen devices via a plugin using this information.

I have tried using this information to set a different style on a temporary basis but nothing I tried seems to work. Tried various pieces of code using a combination of snippets I have found on the net and also having looked through some of the core files to get ideas but nothing works.

I could perhaps just do a template replacement for specific parts but I have searched the forums here trying to find threads on doing this but I haven't been able to find one that deals with the subjects comprehensivly.

So does anyone here have any pointers or tips to help me on implementing this or suggestions on what the best way to implement it will be. Any help or advice is appreciated

kh99 01-10-2012 01:42 PM

We did something like that, I ended up defining a javascript function that checks screen.width and returns a different class name depending on the width. I then put a call to that function in a bunch of html tags that had a class name. Looking at it now I wonder why I didn't just put javascript in the CSS definition so it would only be called once - there may have been a reason, or it may just have been laziness or ignorance :) ). Anyway, it works - it lowers the font size a bit if the screen width is < 1100, which was just enough to make our layout fit on a 1024 display.

LifesGreatestGift 01-10-2012 06:39 PM

Code:

<script type="text/javascript">
if (screen.width <= 1024) window.location.replace("http://www.urltoforum.com/styleforsmallerscreens")
</script>

Pretty sure that if the decided they wanted to use the regular style though, they would be continuously redirected based on screen resolution because the script would just run again on the main style and see they have a small screen and redirect them back to the 'mobile' style.


All times are GMT. The time now is 10:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00975 seconds
  • Memory Usage 1,710KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete