Could someone please explain to me the supposed purpose of .Slice in this piece of code? How can you select a subset of padding-bottom? Thanks a lot.
$(this).bind('click', function(){
var tid = $(this).attr('id');
tid = tid.replace('play-button-', '');
playheight = parseInt($('#play-view-' + tid, 10).height());
playpadding = parseInt($('#play-view-' + tid, 10).css('padding-bottom').slice(0, -2));
var flex_height = playheight + playpadding;
setTimeout(function(){
$('.flex-viewport').animate({height: flex_height});
},200);
});
--- Alternative without using slice ----
$(this).bind('click', function(){
var tid = $(this).attr('id');
tid = tid.replace('playlist-button-', '');
playheight = $('#playlist-display-' + tid).height();
playheight = parseInt(playheight, 10);
playpadding = ('#playlist-display-' + tid);
playpadding = $(playpadding).css('padding-bottom');
if (playpadding != null) {
playpadding = parseInt(playpadding, 10);
flex_height = playheight + playpadding;
} else {
flex_height = playheight;
}
setTimeout(function(){
$('.flex-viewport').animate({height: flex_height});
},200);
});