View Single Post
Old 08-05-2009, 12:55 PM   PM User | #3
lauthiamkok
Regular Coder

 
Join Date: Dec 2008
Posts: 117
Thanks: 14
Thanked 0 Times in 0 Posts
lauthiamkok is an unknown quantity at this point
Quote:
Originally Posted by Iszak View Post
You'd want the "resize" event seen here http://docs.jquery.com/Events/resize
got it thanks. i have made the code, but i still have a little problem with resize event - how can i write it in if/ else condition??

if window resize, run this code,
Code:
$(window).resize(function(){
		var height_window = $(window).height(); 
		var width_window = $(window).width();
		
		var margin_left = (width_window/2) - (840/2);
		$('.slide').css({width:width_window+'px'});
		$('.content').css({marginLeft:margin_left+'px'});
		
		$('#enter').click(function () {
		$('#container').animate({marginLeft:'-'+width_window+'px'}, 600);
		return false;
		});	
		
		$('#back').click(function () {
			$('#container').animate({marginLeft:'0px'}, 600);
		return false;
		});
	});
else run this,

Code:
var height_window = $(window).height(); 
	var width_window = $(window).width();

	var margin_left = (width_window/2) - (840/2);
	$('.slide').css({width:width_window+'px'});
	$('.content').css({marginLeft:margin_left+'px'});
	
	$('#enter').click(function () {
		$('#container').animate({marginLeft:'-'+width_window+'px'}, 600);
	return false;
	});
thanks,
L
lauthiamkok is offline   Reply With Quote