*Christophe: re; Pixel, percent heights.*
Element.style.height returns in percentages.
If you use the prototype element method to getHeight, it returns in pixels,
without the px.
Test case is below.
<html>
<head>
<script src="javascript/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function Begin()
{
var h = $('percenttest').style.height
new Insertion.Top('debug','div Percentage height: ' + h + '<br/>');
var ch = $('percenttest').getHeight();
new Insertion.Top('debug','div Calculated height: ' + ch + '<br/>');
}
</script>
</head>
<body style="height:1000px;" onload="Begin();">
<div id='percenttest' style="height:70%;background-color:#efefef;">
</div>
<div id='debug'>
</div>
</body>
</html>
On 6/10/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
>
> Okay, continuing on from my previous post which details my solution...
>
> here is the new onload
>
>
> var ZoneColumns = $('Zones').getElementsBySelector( 'div.ZoneColumn'
> ).pluck('id');
> $('Zones').getElementsBySelector( 'div.ZoneColumn').each(function (column)
> {
> if ($F('UserId') != 0)
> {
> Sortable.create(column,{
> tag:'div',
> onChange:function(a,b,c) { },
> onUpdate:function(a,b,c) {
> //new Insertion.Top('debug','new childNodeLength: ' + String(
> a.childNodes.length) + '<br/>');
> //new Insertion.Top('debug', a.id + ' event<br/>');
> //new Insertion.Top('debug','sequenced length of droppable: ' + String(
> Sortable.sequence(a).length) + '<br/>');
> //new Insertion.Top('debug','stored length of droppable: ' + String(
> a.readAttribute('currentOrder')).split(',').without('').length + '<br/>');
>
> if (Sortable.sequence(a).length > String(a.readAttribute('currentOrder'
> )).split( ',').without('').length)
> {
> //new Insertion.Top('debug',String( a.id) + ' is the destination
> div<br/>');
> //i think this is probably my most awesome line of prototype code ever...
> var element = $('Zone_'+Sortable.sequence(a).without(String(
> a.readAttribute('currentOrder'
> )).split(',').without('')).flatten().toString()).readAttribute(
> 'zonedataid');
> //new Insertion.Top('debug',element + ' is the draggable div<br/>');
> new Ajax.Request('Ajax.aspx', {method:'post' , parameters:'ZoneDataId='
> +element+'&action=UpdateUserZoneItemColumn&Column=' +String(a.id).replace(
> 'ZoneColumn_',''), onFailure:errFunc });
> a.setAttribute('currentOrder',Sortable.sequence(a));
> }
> },
> dropOnEmpty:'true' ,
> containment:ZoneColumns,
> constraint:false,
> ghosting: false
> });
> //alert(String(Sortable.sequence(column)).split(',').flatten().length);
> column.setAttribute('currentOrder',Sortable.sequence (column));
> }
> column.getElementsBySelector('div.zone').each(function(node){
> if (node.id != null){
> if (node.getAttribute( 'ZoneDataId') != null)
> {
> var url = 'RenderZone.aspx';
> var pars = 'ZoneDataId=' + node.getAttribute('ZoneDataId');
> var myAjax = new Ajax.Updater(node.id, url, {method: 'post', parameters:
> pars, onComplete:processCollapse });
> }
> }
> });
> });
>
>
>
> *Christophe, *I will check that pixel/percent thing in a sec and get back
> to you.
>
> I will also check this diff between scripty and the version I had to use.
>
>
> Gareth
>
>
> On 6/10/07, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hey,
> >
> > Gareth Evans a écrit :
> > > I think the computed values remain as pixels if you use percentages in
> > css?
> >
> > You can check that by using getStyle on the properties you specified as
> > percents, and see what you get. I do believe all length-related props
> > get computed to pixels, which seems to fit the CSS spec.
> >
> > --
> > Christophe Porteneuve aka TDD
> > [EMAIL PROTECTED]
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---