Gavin M. Roy schreef:
> The file size (6.2K) is based upon heavy whitespace and comments. I'm
> working on a comment-less version to cut down on file size and will
> offer both on the page.
>
You could reduce the code by using switch instead of all those if/else
statements. for example
// Apply our css and positioning, then show
if ( animation == 'fade' )
{
$('#modalBackdrop').top(wt).css(css).height(winHeight +
'px').width(winWidth + 'px').show();
modalContent.top(mdcTop + 'px').left(mdcLeft + 'px').fadeIn(speed);
} else {
if ( animation == 'slide' )
{
$('#modalBackdrop').top(wt).css(css).height(winHeight +
'px').width(winWidth + 'px').show();
modalContent.hide().top(mdcTop + 'px').left(mdcLeft +
'px').slideDown(speed);
} else {
if ( animation == 'show')
{
$('#modalBackdrop').top(wt).css(css).height(winHeight +
'px').width(winWidth + 'px').show();
modalContent.top(mdcTop + 'px').left(mdcLeft + 'px').show();
}
}
}
change to
switch(animation){
case 'fade':
$('#modalBackdrop').top(wt).css(css).height(winHeight +
'px').width(winWidth + 'px').show();
modalContent.top(mdcTop + 'px').left(mdcLeft + 'px').fadeIn(speed);
break;
case 'slide':
$('#modalBackdrop').top(wt).css(css).height(winHeight +
'px').width(winWidth + 'px').show();
modalContent.hide().top(mdcTop + 'px').left(mdcLeft +
'px').slideDown(speed);
break;
case 'show':
$('#modalBackdrop').top(wt).css(css).height(winHeight +
'px').width(winWidth + 'px').show();
modalContent.top(mdcTop + 'px').left(mdcLeft + 'px').show();
break;
}
It also makes the code easier to read and manipulate ;)
--
David Duymelinck
________________
[EMAIL PROTECTED]
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/