473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

resize height based on width

116 New Member
i cud get it to resize based on width and height by setting them 100%...but now when i reduce the height even then it alters the size of the site...

wat i want to do it based on width of the screen the height to be calculated and even if i reduce the height of the browser it should not deform...how can i get tht?
Feb 8 '10 #1
3 1691
gits
5,390 Recognized Expert Moderator Expert
so you want to have a fixed window-width-height ratio?
Feb 9 '10 #2
angelicdevil
116 New Member
yes...it shud resize fully based only on width not height
Feb 10 '10 #3
gits
5,390 Recognized Expert Moderator Expert
try something like this:

Expand|Select|Wrap|Line Numbers
  1. var ratio = 4/3;
  2.  
  3. window.onresize = function() {
  4.     var w = window.innerWidth;
  5.     var h = window.innerHeight;
  6.  
  7.     if (w/h != ratio) {
  8.         window.resizeTo(w, w/ratio)
  9.     }
  10. };
Feb 10 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
5645
by: David Hayes | last post by:
juglesh <juglesh@nospamRadioKDUG.com> wrote in "Re: how to maximize the browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12 AM): > > >I want to maximize the browser window when I open a new window. > > function expand() { > window.moveTo(0,0); > window.resizeTo(screen.availWidth, screen.availHeight); > }
17
2763
by: Alex Blekhman | last post by:
Hello, I'm experienced Windows programmer, however, I'm quite novice in HTML technologies. Recently I was assigned a task to write small utility for internal use in our development team. I chose to write its GUI in HTML and make front end as HTA. While developing application's logic is no problem the HTML layout and properties require some additional efforts. So, I
0
1242
by: Rod Billett | last post by:
The included html contains 3 divs. One primary Div, with 2 nested divs. the second nested DIV contains an empty table. Problem 1: Phantom Space. When viewed within the browser, the div 'action panel' is spaced a picel or two lower than the div 'ItemsPanel' even though both are the same height. Oddly enough, if you remove the table (ID Removemetowork) this phantom space dissappears and everything is fine with the world Problem 2:...
2
1503
by: DraguVaso | last post by:
Hi, I have to DataGrid's on a form, one on the top of my form, the other at the bottom, but they though each other somewhere in the middle. What I want now is that, when I resize the form, they resize in the same proportions: So when I resize the Form with 50%, they each have to resize with 50%. The maximum what I can achieve now is that one of them resizes, and the other keeps the same height, if I don't do it like that one of the...
15
5363
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
3
2476
by: Jim Langston | last post by:
I really am not sure if this question belongs in this newsgroup, but not sure where else to ask it. There is someone working on a game that I tested, and it was taking >30 seconds to load. He stated that everyone else was taking 2 or 3 seconds. Then he found one other person taking >30 seconds, and it turns out the common denominator was both of us have Intel chips (Celeron) where the other people have AMD. I had him send me his code...
1
2040
by: | last post by:
I'm creating a user control where the size always needs to be divisible by three. In the resize event within the custom control I'm having no problem maintaining the height to be the same as the width, but as soon as I try to add some code to make sure that the width is always divisible by three, VS crashes. How can I force the width 9and height) to always be a factor of three? Thanks. J
1
2214
by: Starance | last post by:
Well... I'm not sure if this can be fixed, I've tried many ways. But here goes; When you resize your browser window it seems to move my video & photo divs. I want them kept in line with the main div. please help. Yes, its for myspace profile. <div class="main"> <table style="width="800px"; height="1024px"; cellpadding="0"; cellspacing="0";background-color="1c1c1c";"> <tr><td valign="top"> <tr> <td colspan="10">
3
3582
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own little website: 1. Small: DOWNsize of original image to be used as a thumbnail. 2. Medium: DOWNsize of original image to be used as user avatars/icons in forums or profiles.
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.