Re: [jQuery] .height(val) - what am I missing?
Theo Welch wrote: I'm not sure if this is the issue, Adam, but have you tried using a string for the height value instead of an integer... I did try everything here for the value just to be sure, but 1.1 should handle strings or integers according to what I've read - 600 with be 600px, 50em with be 50em, and so on (and it does). Problem was the DOM hadn't loaded, you guys were right about that. I was under the mistaken impression that the $(...) worked as $(fn) for document.ready. Now I know. Just curious, what is the difference between $(fn) and the 'failsafe jQuery' code jQuery(function($) {...}); ? Adam -- View this message in context: http://www.nabble.com/.height%28val%29---what-am-I-missing--tf3015887.html#a8386315 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .height(val) - what am I missing?
On 16/01/07, agent2026 [EMAIL PROTECTED] wrote: Theo Welch wrote: I'm not sure if this is the issue, Adam, but have you tried using a string for the height value instead of an integer... I did try everything here for the value just to be sure, but 1.1 should handle strings or integers according to what I've read - 600 with be 600px, 50em with be 50em, and so on (and it does). Problem was the DOM hadn't loaded, you guys were right about that. I was under the mistaken impression that the $(...) worked as $(fn) for document.ready. Now I know. Just curious, what is the difference between $(fn) and the 'failsafe jQuery' code jQuery(function($) {...}); ? Adam -- You only need to use jQuery(function($) {...}) if you are using a library that also uses $ (e.g prototype). It prevents conflicts from occurring. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] .height(val) - what am I missing?
All Im trying to do is set the height of a div (jQuery 1.1), but no go. What am I missing? script type=text/javascript !-- $(#myDiv).height(600); -- /script div id=myDiv style=border:1px solid #f00/div Preparing to feel dumb, Adam -- View this message in context: http://www.nabble.com/.height%28val%29---what-am-I-missing--tf3015887.html#a8375281 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .height(val) - what am I missing?
Hmm... I can't verify this. I popped open a test page and set the .height() and it worked just fine. Perhaps a more complete example is in order? --John On 1/15/07, agent2026 [EMAIL PROTECTED] wrote: All Im trying to do is set the height of a div (jQuery 1.1), but no go. What am I missing? script type=text/javascript !-- $(#myDiv).height(600); -- /script div id=myDiv style=border:1px solid #f00/div Preparing to feel dumb, Adam -- View this message in context: http://www.nabble.com/.height%28val%29---what-am-I-missing--tf3015887.html#a8375281 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .height(val) - what am I missing?
On 15/01/07, John Resig [EMAIL PROTECTED] wrote: Hmm... I can't verify this. I popped open a test page and set the .height() and it worked just fine. Perhaps a more complete example is in order? --John On 1/15/07, agent2026 [EMAIL PROTECTED] wrote: All Im trying to do is set the height of a div (jQuery 1.1), but no go. What am I missing? script type=text/javascript !-- $(#myDiv).height(600); -- /script div id=myDiv style=border:1px solid #f00/div Preparing to feel dumb, Adam -- Looks like you are trying to set it before the DOM has loaded. Try: script type=text/javascript !-- $(function() { $(#myDiv).height(600); }); -- /script div id=myDiv style=border:1px solid #f00/div ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .height(val) - what am I missing?
I'm not sure if this is the issue, Adam, but have you tried using a string for the height value instead of an integer...and in doing so, also specifying an explicit unit of measure (such as pixels)? Generally, CSS rules won't honor values that don't have units (unless the value is zero in which case units are obviously irrelevant). Also, as Sam said, to make sure the DOM element (in your case: div id=myDiv!-- contents here --/div) you are trying to affect has been loaded into memory by the browser, you need to wrap your statements inside one of the several varieties of jQuery load-check wrappers. Code within these jQuery wrappers won't execute until the DOM is ready (one of the best features of jQuery!). Extending Sam's example, try specifying a 600px height like so: script type=text/javascript !-- $(function() { $(#myDiv).height(600px); }); -- /script div id=myDiv style=border:1px solid #f00;/div -THEO- -Original Message- From: Sam Collett [mailto:[EMAIL PROTECTED] Sent: Monday, January 15, 2007 1:15 PM To: jQuery Discussion. Subject: Re: [jQuery] .height(val) - what am I missing? On 15/01/07, John Resig [EMAIL PROTECTED] wrote: Hmm... I can't verify this. I popped open a test page and set the .height() and it worked just fine. Perhaps a more complete example is in order? --John On 1/15/07, agent2026 [EMAIL PROTECTED] wrote: All Im trying to do is set the height of a div (jQuery 1.1), but no go. What am I missing? script type=text/javascript !-- $(#myDiv).height(600); -- /script div id=myDiv style=border:1px solid #f00/div Preparing to feel dumb, Adam -- Looks like you are trying to set it before the DOM has loaded. Try: script type=text/javascript !-- $(function() { $(#myDiv).height(600); }); -- /script div id=myDiv style=border:1px solid #f00/div ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/