Resize function by adding 100 pixels on top of what is there now?
I recently learned that I cou开发者_JAVA百科ld do this: height()+100);
So I when I tried to do:
$('.modal1').colorbox.resize({height()+100});
I was confused why that did not work. What I want to do is (if possible, without variables) just add extra 100 pixels to the height, is this possible? Thanks :)
Uh, you're misunderstanding the API. height
is a method attached to a jQuery object. You'll have to do something like this:
// there may be more than one, seeing as this is a class, not an ID selector
$('.modal1').each(function () {
$(this).colorbox.resize($(this).height() + 100);
// or this if you are just using jQuery to resize
// $(this).height($(this).height() + 100);
});
Looking at your code, color-box probably has a special handler for 'resize'. For each match, we'll adjust the size using colorbox's resize. If colorbox doesn't have a special resize method, use jQuery's instead. We'll still use the height from jQuery (or we could use colorbox's handler for this if it has one).
精彩评论