Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Galleria Fatal error: Could not extract a stage height from the CSS. Traced height: 0px

If I have the line <style type="text/css"></style> , even though it is blank, Galleria throws the error message "Fatal error: Could not extract a stage height from the CSS. Traced height: 0px."

It would appear that even though I'm telling galleria to use a height of 300 via:

$('#galleria').galleria({ 
width: 300, 
height: 300, 
transition: 'fade' 
}); 

it tries to first determine the height and the CSS line is confusing it, so it throws this error. If I remove that one line, no more error.

Is there anyway I can still use <style type="text/css"></style>? we use it to customize the look and feel of our site based on the customer using it.

like image 287
SLoret Avatar asked Jul 07 '11 12:07

SLoret


2 Answers

Make sure you include:

Head:

<link type="text/css" rel="stylesheet" href="galleria/themes/classic/galleria.classic.css">
<script type="text/javascript" src="js/galleria-1.2.5.min.js"></script>
<script type="text/javascript" src="galleria/themes/classic/galleria.classic.min.js"></script>

Also the in page style:

#galleria{height:467px}

And below the images:

<script type="text/javascript">
$('#gallery').galleria({
width: 700,
height: 467 //--I made heights match
});
</script>

If you have problems with this troubleshoot with a clean installation and add until you find the cause.

like image 77
Emilio Avatar answered Oct 18 '22 07:10

Emilio


It might help some one, who still gets this error:-

I got this error because I had a hidden gallery.

FIX:- Give the gallery div a height in CSS, then in js file,

Galleria.run('#gallery', {
  height: parseInt($('#gallery').css('height')),
  wait: true
 });

See these links for more info:- http://galleria.io/docs/references/errors/

http://galleria.io/docs/options/wait/

like image 12
Divyanshu Das Avatar answered Oct 18 '22 07:10

Divyanshu Das