开发者

animating the trigger element of jquery datepicker to be the same width as the datepicker

开发者 https://www.devze.com 2023-03-10 22:02 出处:网络
I have a lin开发者_如何学Gok element that has a datePicker attached. The link is styled to look like a button. I would like to animate the link to become the same width as the datepicker when this is

I have a lin开发者_如何学Gok element that has a datePicker attached. The link is styled to look like a button. I would like to animate the link to become the same width as the datepicker when this is shown.

Somehow the jQuery animate library must know the final width and height of the datepicker in order to animate it. So how do I tap in to that or how do I make the animation run for both the trigger link and the datepicker element?


I found out that something like this works just fine.

$('#target').datepicker('show');
$('#target').animate({'width': $('#target').datepicker('widget').width()}, 500);

Then you just have to find the correct animation type and duration that matches the animation of the datepicker.

I ended up not using this though, so no testing has been done on it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号