【问题标题】:Make div smooth bigger and view other content, toggeling使 div 平滑更大并查看其他内容,切换
【发布时间】:2011-06-18 06:25:09
【问题描述】:

我有一个名为 foo 的 div。这是 div 的 css:

background-color: #FFFF00;
float:right;
width: 50px;
height: 50px;

它在另一个 div 的右上角。 好吧,如果我点击它,我想平滑地更改内容,并将大小/css 平滑地更改为:

background-color: #FFFF00;
float: right;
width: 255px;

我想切换它...我知道使用 jQuery 一切皆有可能,但如何实现呢?我可以使用哪些功能?最好的方法是什么?

问候

【问题讨论】:

标签: jquery css jquery-animate smooth


【解决方案1】:

是的,您可以使用切换功能和动画来做到这一点,请参见以下示例:

    $(document).ready(function(){   $(".slide").toggle(
    function () {
        $("#slider").animate({marginLeft: "-400px"}, 1000, "easeInOutQuad")
    },
    function () {
        $("#slider").animate({marginLeft: 0}, 1000, "easeInOutQuad")
    }
);});

您可以更改参数以满足您的需求

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-25
  • 2012-09-08
  • 2014-01-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多