CPVLab Discount: Save $50!
  #1  
Old 11-11-2010, 11:57 PM
Kevin's Avatar
Member
 
Join Date: Sep 2010
Posts: 58
Thanks: 0
Thanked 4 Times in 2 Posts
Default Resize on click?

My search results on this topic indicate how to resize, but not how to resize on a click.

I see there's some kind of onclick event, and the self.resizeto, but I don't know if these are the right ones to work with for this goal, nor how to combine them.

I don't know enough about javascript to figure this one out without spending a couple hours. So I figure asking here is faster

I want to resize the pop window whenever anything in the lander is clicked. Or if that's hard, just when they click certain elements would be fine too.
__________________
If you like this post, check out my blog!
http://www.kevinkimes.com
Reply With Quote
  #2  
Old 11-12-2010, 01:44 AM
 
Join Date: Oct 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use jQuery:

$("a").click(function() {

window.resizeTo(800,600);

}

Whenever the user clicks a link on the page, resize the window to 800x600
Enjoy!
Reply With Quote
  #3  
Old 11-12-2010, 02:19 PM
Moderator
 
Join Date: May 2008
Posts: 554
Thanks: 10
Thanked 61 Times in 26 Posts
Default

Sweet!

I've been using the javascript(void) as mentioned in this forum in another post. I'm going to try your solution.

-Aaron
Reply With Quote
  #4  
Old 11-13-2010, 05:46 AM
Member
 
Join Date: Jul 2010
Posts: 43
Thanks: 2
Thanked 1 Time in 1 Post
Default

Ignore this...its already been answered perfectly above

~Ian

Last edited by aeroian; 11-13-2010 at 06:15 AM.
Reply With Quote
  #5  
Old 11-13-2010, 09:14 PM
CPVDen Co-Owner
 
Join Date: Apr 2010
Location: hhi
Posts: 863
Thanks: 69
Thanked 63 Times in 50 Posts
Default

another option is the following which i think sean's posted, but just in case...

function movesizeandopen()
{
//self.moveTo(0,0)
self.resizeTo(900,900)
}


jquery is way cooler though

- lucas
Reply With Quote
  #6  
Old 11-15-2010, 01:15 AM
Kevin's Avatar
Member
 
Join Date: Sep 2010
Posts: 58
Thanks: 0
Thanked 4 Times in 2 Posts
Default

Thanks guys.

That jQuery thing goes where in the page? I'm not even worthy of being called a noob at javascript, and I don't even know what jQuery is. :P

Also, how about when they click in a text field?
__________________
If you like this post, check out my blog!
http://www.kevinkimes.com
Reply With Quote
  #7  
Old 11-15-2010, 03:00 PM
 
Join Date: Oct 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Originally Posted by Kevin View Post
Thanks guys.

That jQuery thing goes where in the page? I'm not even worthy of being called a noob at javascript, and I don't even know what jQuery is. :P

Also, how about when they click in a text field?
jQuery is a Javascript library. You can download it here: http://jquery.com/
You can host the file on your own server or you can have google host it for you.

So, to include the jQuery library, throw this code in the <head> of your HTML doc:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
Then, you just put this code right before your </body> tag:

<script type="text/javascript">

$("a").click(function() {

window.resizeTo(800,600);

}
</script>
Reply With Quote
  #8  
Old 11-15-2010, 04:44 PM
 
Join Date: Oct 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Or if you guys wanted to expand your pop ups instantly use:

Code:
$(document).ready(function() {window.resizeTo(screen.width,screen.height-30);});
Note: Had a quick look through MTs T&Cs and it only mentioned that it was disallowed to use resizing if the browser controls were unavaivable, as you can see from testing the above, all controls are there for the punter to exit your popup
Reply With Quote
  #9  
Old 11-17-2010, 05:20 AM
Kevin's Avatar
Member
 
Join Date: Sep 2010
Posts: 58
Thanks: 0
Thanked 4 Times in 2 Posts
Default

Hey, one more thing, how can I make the jquery one work for when a submit button is clicked?
__________________
If you like this post, check out my blog!
http://www.kevinkimes.com
Reply With Quote
  #10  
Old 11-19-2010, 12:32 AM
Kevin's Avatar
Member
 
Join Date: Sep 2010
Posts: 58
Thanks: 0
Thanked 4 Times in 2 Posts
Default

There is an error in the code above. It needs a close-parenthesis.


<script type="text/javascript">

$("a").click(function() {

window.resizeTo(800,600);

})(like this)
</script>
__________________
If you like this post, check out my blog!
http://www.kevinkimes.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:16 PM.


Search Engine Optimization by vBSEO 3.6.0