Topic: Bug: Height Calculation is wrong I believe (when using 100%)

Hi,

I have been battling with the HTML integration of the gallery for a full day... and came to the conclusion that there must be something wrong with the calculation of the height of the flash component when passing it the 100% parameter in HTML.

Basically the flash is always as big as the body height rather than the container div. This is really annoying because it prevents me from building a simple: header/body/footer structure with a "stick to the bottom" footer.

You can look at the following example which illustrates my issue: http://dev.eclecticshot.com/index2.php

I have been trying to look at the JS code that I believe is calculating the height, but it's simply impossible to reverse engineer being all compressed on line.

I would really appreciate some help on issue ! Thanks !

Alex
http://www.eclecticshot.com

Re: Bug: Height Calculation is wrong I believe (when using 100%)

Your page seems to be working in Chrome, try adding a doctype to the top of the html code and fixing the html errors.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

You can see an example with a header and footer here.

Mike Richards
SimpleViewer Support Team.

Re: Bug: Height Calculation is wrong I believe (when using 100%)

Perfect ! Thanks for your help, now with that sample code I should be able to get it done the wait I want to...
However in the sample given the piece allowing the switch between the ICC and non ICC is not there ?

Anyway, that's my point exactly, because to make that sample work, they added some addition javascript to fix the height calculation:

$(document).ready(function () {
  setTimeout(doLayout, 100);
  $(window).bind('resize', doLayout);
  
});

function doLayout() {
  var winHeight, headerHeight, footerHeight;
  winHeight = window.innerHeight ? window.innerHeight : $(window).height();
  headerHeight = $('#header').outerHeight();
  footerHeight = $('#footer').outerHeight();
  $('#flashContent').height(parseInt(winHeight) - parseInt(headerHeight) - parseInt(footerHeight));
}

This code should not be necessary if the Height calculation was done correctly in the first place... And what's really weird to me is that the problem only occurs on Height and not width. If you constrains the container of the flash-content to let's say 400px it will be that width, however doing the same to the height simply won't work. I have quickly modify my index2.php to illustrate:
http://dev.eclecticshot.com/index2.php

I have set fixed dimension to width and height of the flash container (300px / 300px) and as you can see, only the width reaction properly (at least on Safari and Firefox). So I maintain that there is a bug.

But I'll make it work with your work around ! Thanks !

Alex

Re: Bug: Height Calculation is wrong I believe (when using 100%)

Well actually no it does not work sad

I managed to reproduce the example you gave me, but only using the "old" way of calling the flash for simpleviewer...

The version that does not allow for the HTML5 gallery nor the ICC version sad

If I put this code:

      <script type="text/javascript">
      var flashvars = {};
      flashvars.galleryURL = "gallery.xml";
      var params = {};            
      params.allowfullscreen = true;
      params.allowscriptaccess = "always";
      params.bgcolor = "222222";
      swfobject.embedSWF("svcore/swf/simpleviewer.swf", "flashContent", "100%", "600", "9.0.124", false, flashvars, params);
    </script>

then it works as I want it (bottom footer, etc.) but if I put the code generated for me by svBuilder:

    <script type="text/javascript">
        $(document).ready(function () {
            SV.simpleviewer.load('flashContent', '100%', '100%', '222222', true);
        });
    </script>

then the template explodes.. and I am back to square one sad Please help !

Alex

Re: Bug: Height Calculation is wrong I believe (when using 100%)

Have you tried setting the flashContent div to 100% height with css?

Mike Richards
SimpleViewer Support Team.

Re: Bug: Height Calculation is wrong I believe (when using 100%)

Yes of course I have. And that's were the whole comes from, is that if you set the height to 100% for FlashContent, it will take the entire windows height, rather than the container div allowed height. It acts as if the height was fixed rather than dynamic and just simply destroy any other adjustment done... sad

This happens only with Height, the width works just fine which is why I believe there is a bug somewhere in the height calculation.

Re: Bug: Height Calculation is wrong I believe (when using 100%)

Ok, thats what I thought. Flash does like to be as big as it can when you give it 100% size and the browsers handle hight differently, but it sounds like a CSS layout issue with your code. 100% means the available/undefined space will be used. It is a matter of defining all of the space in your page so that the 100% item does not use it. Try taking a look at an example such as http://positioniseverything.net/guests/3colcomplex.html

Mike Richards
SimpleViewer Support Team.