I'm struggling with this Javascript:
width = screen.width * .75;
height = screen.height * .75;
$(".colorbox").colorbox({
width:"800px",
height:"600px",
iframe:true,
scrolling:false});
I am trying to put the values of width and height into the 800 and 600 spots, respectively.
Aaron Yodaiken
19.7k33 gold badges110 silver badges189 bronze badges
2 Answers 2
This is pretty straightforward to fix:
var width = screen.width * .75;
var height = screen.height * .75;
$(".colorbox").colorbox({
width: width,
height: height,
iframe: true,
scrolling: false});
(Just a side note, put var before your variable declarations, or else they will become global, perhaps unintentionally).
answered Aug 15, 2011 at 4:39
Peter Olson
144k49 gold badges210 silver badges250 bronze badges
Colorbox actually supports specifying the widths as integers or with a unit..
So,
$(".colobox").colorbox({
"width": width,
"height": height
});
answered Aug 15, 2011 at 4:41
Stephen
3,4421 gold badge24 silver badges22 bronze badges
Comments
lang-js