Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-29-2009, 12:29 PM
  #1
nickbfromct
Aspirant (Level 2)
 
nickbfromct's Avatar
 
Join Date: Aug 2009
Posts: 16
iTrader: (0)
nickbfromct can only hope to improve
Question re-sizing images

I am trying to re-size images with javascript and i can get the image to whatever I want BUT.... I don't want the image to show up before it re-sizes. I tried to make the image invisible while I re-size it but for some reason it won't resize while invisible. HERES THE CODE:

Code:
var desiredW = 420;

function resizeimage()
	{
		var imgW = document.getElementById('mainImage').width;
		
		if(imgW > desiredW)
		{
			document.getElementById('mainImage').width = desiredW;
		}
		
		document.getElementById('mainImage').style.visibility = "visible";
		document.getElementById('mainImage').style.display = "block";
	}
The event is body onload. Anyone have any ideas?
nickbfromct is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-30-2009, 03:46 AM
  #2
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 2,243
iTrader: (0)
¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all¥åßßå is a name known to all
Whilst your images are loading, position them absolute a mile off the top/left of teh screen. When they've loaded and you've resized them, remove the position:absolute and they'll slip into the correct place

¥
__________________
I may have opened the door, but you entered of your own free will

¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-30-2009, 04:14 PM
  #3
nickbfromct
Aspirant (Level 2)
 
nickbfromct's Avatar
 
Join Date: Aug 2009
Posts: 16
iTrader: (0)
nickbfromct can only hope to improve
Quote:
Originally Posted by ¥åßßå View Post
Whilst your images are loading, position them absolute a mile off the top/left of teh screen. When they've loaded and you've resized them, remove the position:absolute and they'll slip into the correct place

¥
you know...I thought of that but I didn't want to go through the hassle of finding the position of the image. I found a fix though. I was using visibility: hidden and display: none to make my image insvisible then resizing it then making it visible again. What I needed to use was filter: alpha(opacity=0) and opacity: 0 And then after I resize I set them to 100 and 1. Worked like a charm. www.ballinornot.com to see the results
nickbfromct is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 06:39 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.