vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Auto-Stretch logo (https://vborg.vbsupport.ru/showthread.php?t=73616)

manguish 01-01-2005 12:46 PM

Auto-Stretch logo
 
At the top of the forum pages everyone obviously has their logo.

I also want to add a banner next to it - no problem.

BUT.

If i view it in my 1152x864 screen it looks fine. If someone in 800x600 (for example) looks at it - its all off to the right side of the screen (creating a scroll bar).

How can i auto resize it to not so this? Will it involve using conditionals and differing banners to achieve the "fit on page" scenario?

SVTBlackLight01 01-01-2005 06:44 PM

I don't know how to do it, but to point you in the right direction, it will require the use of JavaScript to detect the users resolution.

SVTBlackLight01 01-01-2005 07:11 PM

I found this code that should do what you need.

Code:

<html>
<head>
<script>

window.onload = setBanner;

function setBanner()
{
  var w = screen.availWidth;
  var i = document.getElementById('banner');
  if (w >= 1000) {
        i.src = 'image_big.jpg'
  }
  else if (w >= 700) {
        i.src = 'image_medium.jpg'
  }
  else {
        i.src = 'image_small.jpg'
  }
}
</script>
</head>
<body>

<img id='banner' src=''>

</body>
</html>


Guy G 01-01-2005 07:15 PM

make sure that the table width is at percentage and not pixels.
example, width="50%" and not width="350pix"

manguish 01-02-2005 02:29 PM

Cheers - i'll give it a go and report back ;)

funinthesun 04-20-2006 09:04 PM

Where do you put that code?


All times are GMT. The time now is 05:15 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.01759 seconds
  • Memory Usage 1,714KB
  • 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
  • (6)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