Commit d100def5a44a24a9ddd1b3f5ddd24be2810d8285
Committed by
Rodrigo Souto
1 parent
c483ebeb
Exists in
master
and in
22 other branches
Improving colorbox window size defaults
Showing
1 changed file
with
12 additions
and
5 deletions
Show diff stats
public/javascripts/application.js
| ... | ... | @@ -955,11 +955,18 @@ log.error = function() { |
| 955 | 955 | |
| 956 | 956 | jQuery(function($) { |
| 957 | 957 | $('.colorbox').live('click', function() { |
| 958 | - $.fn.colorbox({ | |
| 959 | - href:$(this).attr('href'), | |
| 960 | - maxWidth: '600', | |
| 961 | - maxHeight: '550', | |
| 962 | - open:true | |
| 958 | + $.colorbox({ | |
| 959 | + href: $(this).attr('href'), | |
| 960 | + maxWidth: $(window).width()-50, | |
| 961 | + height: $(window).height()-50, | |
| 962 | + open: true, | |
| 963 | + fixed: true, | |
| 964 | + close: 'Cancel', | |
| 965 | + onComplete: function(bt) { | |
| 966 | + var opt = {}, maxH = $(window).height()-50; | |
| 967 | + if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH; | |
| 968 | + $.colorbox.resize(opt); | |
| 969 | + } | |
| 963 | 970 | }); |
| 964 | 971 | return false; |
| 965 | 972 | }); | ... | ... |