Window.resizeTo() Inside A Window.onResize Event Handler Function?

Apr 23, 2011

I want to preserve a 16/9 aspect ratio to the window after any resize, making the width a function of the height.

As I have a window.resizeTo() inside the window.onresize event function, the infinite loop is served. How may I quit it?

<html><head><title>Title</title><script languaje="javascript">
const c_ra=16/9;
window.onresize = function WindowReSize() {
var myWidth = 0, myHeight = 0;

[Code].....

View 2 Replies


ADVERTISEMENT

Closing Popup Window With OnBlur Event Handler?

Jul 20, 2005

I want to close a popup-window with the onBlur eventHandler.
function closeIt() {
setTimeout('window.close()',2000); }
<body onBlur="closeIt()">
html
</body>

There is a form on my page, and when a input-field gets focus, body looses focus and the window closes. That's not what I want. I want to close the window, if focus goes to another
window or application, but not when someone tries to fill that form.

View 2 Replies View Related

Window.open / ResizeTo Problem

Jul 23, 2005

The following code opens a new window, but the "resizeTo" doesn't resize it.
Why not?

View 10 Replies View Related

Child Window Close Event - Opening Another Link In A Separate Window Using Window.open()

Jan 29, 2010

I have a HTML and I am opening another link in a separate window using window.open() . The child window is something like 'http://yahoo.com' which is out side html. I need to refresh the parent window when the child window is closed.

View 4 Replies View Related

Getting Window Dimension With Onresize

Apr 10, 2009

I want to make a nice floating bar at the bottom of the screen, which hovers about 15px from the bottom. I am doing this to make a site look good in small and big resolutions. The minimum height for the bar to hover is 600px about, if the window is smaller, it is still there so it doesn't go into the content, if the window is bigger, it will follow the resize and be at the bottom still. It is obviously absolutely positioned, and also centered using some javascript (getting the width of the window).The second function is called in the header and positions the bar. The last two document.get things are just for testing so I can see the height in px somewhere. This works fine in IE. If I resize the window, making it shorter, everything goes as planned, and I can see the pixel count dropping in the header where it is displayed. However, in FF it does not work.

The weird thing is this. If I resize by a small amount, less than 10px, it works fine. However, I can not resize by more than 10px! If I do, the window height shown in the top still drops by only 10px.So if my window is 1000px tall, and I close it to say 500px, the value of the height will still be 990px. If I then resize it to any where higher than the 500px, say 550px, the javascript still sees it as making it smaller, since it says the height is 990px, therefore, the window height goes down to 980px. If I shrink the window to 500px and reload everything is fine, if I make it bigger, it works in both browsers. I am thinking that this could be a problem which is like "sampling rate" in music. When in IE I expand or shrink the window I can see the pixel count drop continuously and the bar floating down as I move the window, as if it was "sampled" every 0.05 seconds or something. In FF, shrinking is not working, but if I expand the window the pixel count doesn't change and the bar doesn't change place until I stop resizing (let go of the mouse button), as if it was sampled once, when I stop, so the problem maybe is related?

View 1 Replies View Related

Window.onresize Slow (firefox)

Mar 19, 2007

I am attempting to modify the style of an element (its width) as the
window is being resized, in firefox.

Long story short, I've tried to use CSS but one particular part of the
layout just won't do what I need.

The javascript solution assigns a function to window.onresize that
sets the inline style, it works with one problem -- the handler only
gets called after the resizing stops, and so there is noticeable lag
before it redraws.

It is not the function that is taking a long time to execute, its
appears to be firefox's handling. It doesn't call it as frequently as
I expected.

Is there another javascript method to accomplish this without the
extra lag?

View 2 Replies View Related

Window.onresize, Width & Scrollbars

May 17, 2007

I'm listening for the window.onresize event and trying to get the document.body.clientWidth afterwards to make sure a wide block fits onscreen. I'm working in Firefox and the thing is, when a scrollbar is added to the page due to content getting longer, the body.clientWidth gets smaller, but the window.onresize doesn't fire (I guess this makes sense as the window hasn't been resized per se).

I am assuming that I will have to check the body.clientWidth manually after the content gets longer and then call my resize function if so. But is there a way to achieve this or watch body.clientWidth other than window.onresize?

View 2 Replies View Related

Window.onresize And Text Size Change

Jan 7, 2005

The window.onresize is not called (in Mozilla) when changing the text size on the browser (crtl + or View/Text Zoom).

Is the xAddEventListener function usefull ? What does the "For some browsers the window.onscroll and window.onresize events are simulated." mean ?(found in the X Library function reference).

View 2 Replies View Related

Window.onresize Firing When The Page Is Initially Loaded?

Jan 16, 2009

I'm having a problem with window.onresize firing when the page is initially loaded.

View 2 Replies View Related

JQuery :: Adding Event Handler To A TextBox Inside A TabContainer?

May 14, 2010

I have a TabContainer on my page, and I want to add a keyup handler to the textbox, but somehow I counldn't find the textbox in my jquery function using $('#TabContainer1_TabPanel1_TextBox1'). Here is my code:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js" >

[Code].....

View 3 Replies View Related

JQuery :: Context Lost When Using $.post Inside A Delegated Event Handler?

Jun 26, 2010

I have some code that's a more involved version of this:

$('#container_div').delegate('.trigger_button', 'click', function() {
$.post('handler.php',
{ id: $(this).siblings('.item_id').val() },
function(data) {

[Code].....

Normally, when I use .post in an event handler, "this" refers to the object that triggered the event. That doesn't happen in this case. When I use "this" the first time, to pull data parameters, it refers to the .trigger_button. But inside the .post callback, it refers to the AJAX call object instead. I don't think that's how it's supposed to work, is it? Is this a bug?

View 1 Replies View Related

Window.open Not Working From Inside User Defined Function

Jul 20, 2005

I'm trying to use window.open from inside a user defined function, and
it's not working.

Mountain Man
============

<script>

function openFootnote(contentURL) {
window.open('contentURL','footnotes','height=180,w idth=160');
}

</script>

I've tried calling on the function 2 different ways, as shown below.
Nothing happens either way.

<a href="javascript:(void)" onClick="openFootnote(fn1.html);">...</a>

<a href="javascript:(void)" onClick="return
openFootnote(fn1.html);">...</a>

View 2 Replies View Related

Build A Function Inside The Html_text That Can Be Called Within The Popup Window?

Feb 16, 2009

i am using popupwindow.document.write(html_text); all the html of the pop-up goes into html_text.how can i build a function inside the html_text that can be called within the popup window?

View 6 Replies View Related

Capture Child Window Close Event In Parent Window?

Feb 1, 2010

I have an HTML page where I am opening a child window using window.open. the child window is something like yahoo.com. I want to refresh the parent window when the child window is closed.

View 1 Replies View Related

Pass A PHP Variable To A Window.onload Event Function?

Dec 21, 2009

How do I pass a PHP variable into a window.onload event function? I have a URL that I need to pass to the JavaScript file that has this function in it. The JavaScript file itself is being linked from the PHP file that will pass the variable and I've seen many examples of how this is done via embedded JavaScript, but none where someone is linking to an external JavaScript file. I suppose this is probably a trivial matter to most of you, but I've never done this before and could use some guidance!

View 16 Replies View Related

Add A New Function To An Event Handler

Jan 12, 2006

I try to add a function to be triggered also within an event (which already has a function). I coded it, unfortunatelly one line of the code should be different for IE and Moz. I try to find a common way without using a browser detector... Any ideea? The red line works for Mozilla, the blue one for IE:

function addFunc(){
var e = document.getElementsByTagName('*');
for(var i=0;i<e.length;i++){
if(e[i].getAttribute('onclick')||e[i].getAttribute('onclick')!=null){// Moz || IE
//var f = new Function(e[i].getAttribute('onclick'));
var f = e[i].getAttribute('onclick');
e[i].onclick=function(){f();otherFunction()}
}}} Code:

View 6 Replies View Related

JQuery :: How To Get Event Handler Function

Jun 9, 2009

<label id="mylabel" onclick="myOnclickFunction()">My Label</label>

How to get the "myOnclickFunction()" _string_ with jQuery? JavaScript getAttribute("onclick") works fine, but I want to do it through jQuery.

View 1 Replies View Related

JQuery :: Adding Prototype Function As An Event Handler?

Aug 30, 2010

I need to know how to add an event to a button. The specific issue is that I want to add an event which is a prototype function of a class. Consider the following as an example:

MyTestClass = function() {
this.firstName = "Pete";
this.lastName = "Johnson";

[code]....

View 2 Replies View Related

Call Parent Window Function From Child Window?

Jan 18, 2010

I have created and opened a child window called "checkwin" and have written some data to it. If the data is valid, I want the user to click on the 'CONFIRM' button on the child window, at which time I want the "submit()" function for the form on the parent window to be executed. If the data is invalid the user clicks on 'MODIFY' and I want focus to return to a field on the parent form. However, when I click on the "CONFIRM" or "MODIFY" buttons on the child window, nothing happens. Here is the code:

checkwin.document.write("</td></tr><tr><td align='right'><input type='button' value='CONFIRM'
onclick='opener.document.personnel_form.submit()'></td><td></td><td><input type='button' value='MODIFY'
onclick='opener.document.personnel_form.first_name.focus()'></td></tr></table>")

View 1 Replies View Related

Set An Onclick Event Handler To Call A Function Which Requires A Parameter?

Jun 11, 2011

Is it possible to set an html element's (created through HTML DOM's createElement() method) 'onclick' attribute's value to a Javascript function which requires a parameter, passing a variable to it at the same time?

I have the following Javascript code:

var parentDiv = document.getElementById("subscribers");
var stubSpan = document.createElement("span");
stubSpan.id = "opentok_subscriber_" + stream.streamId;
stubSpan.onclick = showStreamInFullScreenMode(stream);
parentDiv.appendChild(stubSpan);

'stream' in the bolded line is a parameter variable of the function that the above code is in, and I'm trying to pass it to another function using an onclick event.

View 2 Replies View Related

Evaluate JS Inline - Pass The Current Window Location Through A Hidden Input To A Php Form Handler

Aug 3, 2010

I need to pass the current window location through a hidden input to a php form handler. I tried this:

Code: <input type='hidden' name='curpage' value='javascript:window.location'>

And this: Code: <input type='hidden' name='curpage' value='javascript:print window.location;'>

View 2 Replies View Related

How Do I Set A Div Width Through The Onresize Event?

Jan 3, 2003

I am trying to set a div width through the onresize event. For some reason, I am able to set the height ok. When setting the width, it will set once and then both the height and the width will not respond to the onresize event anymore. I basically want the div to resize whenever the browser is resized.

To demonstrate what I mean, copy and paste this code into a htm file. Add long strings of text to the div so that it will scroll both horizontally and vertically. Notice when resizing, the resize will get called once, but when resizing again it will not. Comment out the width line, and now the resizing will always get called.

Here is the code:

View 2 Replies View Related

JQuery :: $.url() Function - Being Utilized For Parsing Out The Window.location Or Window.location.search Parameters

Feb 14, 2010

Danged if I can find the thread, but I swear I saw a $.url() reference in here a day or two ago. It was beingutilized for parsing out the window.location or window.location.search parameters. I made a mental note because that was something I would be needing to do.

Now I can't find it, either because the search isn't finding it or I was dreaming about this function existing.

I rummaged about the API docs and didn't find it there either. Is it something provided by one of the plugins and not a function native to jQuery?

View 3 Replies View Related

Use The OnResize() Event To Dynamically Resize A Webpage?

Oct 27, 2008

How does one use the onResize() event to dynamically resize a web page according to the size of the user's viewport?

View 10 Replies View Related

Refreshing Page At OnResize Event: Problem With Firefox

Aug 27, 2005

I need to refresh page cathcing "onResize" event.

I wrote this code:

<body onResize="javascript:winodw.location.reload(true); return true;">

On I.E. it works, but it doesn't work on Firefox.

View 6 Replies View Related

Resize The Inside Of A Window

Oct 26, 2002

This is something that i came up with a while back, but never got around to putting up. when you resize a window, you don't get the same result across different browsers because of different chrome sizes. the way around this, is to resize your window based on the visible document area. this function does that.

this should work in IE4+ and NS4+. i've tested it in IE5+, and Moz 1+

<SCRIPT><!--
self.resizeIn = function(new_w, new_h) {
var old_w = self.innerWidth || document.body.offsetWidth;
var old_h = self.innerHeight || document.body.offsetHeight;
if (!new_w) { new_w = old_w; }
if (!new_h) { new_h = old_h; }
new_w -= old_w; new_h -= old_h;

self.resizeBy(new_w,new_h);
}
//--></SCRIPT>

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved