首页 \ 问答 \ 第二次单击时jquery反向动画(jquery reverse animation on second click)

第二次单击时jquery反向动画(jquery reverse animation on second click)

我想在第二次点击时有一个反向动画,但第二个动画必须与第一个相反,但必须有相同的动画。 我也在jquery写道,因为我希望在点击后对象保持在该位置,直到我再次点击。

我希望你明白我的意思。 万分感谢!

JavaScript的:

$('.linguait').click(function() {
    if (('.linguait').hasClass('active')) {
        $('.linguait').removeClass('active');
        $('.linguait').addClass('deactive');  
     } else{
        $('.linguait').removeClass('deactive');
        $('.linguait').addClass('active');
     }
 });

CSS:

linguait.active {
    right:25%;
    margin-right: -10px;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    -webkit-transition: right 2s, margin-right 2s, -webkit-transform 2s;
    transition: right 2s, margin-right 2s, transform 2s;
}

.linguait.deactive {
    right:5%;
    margin-right: -2px;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    -webkit-transition: right 2s, margin-right 2s, -webkit-transform 2s;
    transition: right 2s, margin-right 2s, transform 2s;
}

I would like to have a reverse animation on second click, but the second animation must be the opposite of the first but must have the same moviments. I wrote also in jquery because I want that after click the object stays in the position until I click again.

I hope you understand what I mean. Thank you a lot!

JavaScript:

$('.linguait').click(function() {
    if (('.linguait').hasClass('active')) {
        $('.linguait').removeClass('active');
        $('.linguait').addClass('deactive');  
     } else{
        $('.linguait').removeClass('deactive');
        $('.linguait').addClass('active');
     }
 });

CSS:

linguait.active {
    right:25%;
    margin-right: -10px;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    -webkit-transition: right 2s, margin-right 2s, -webkit-transform 2s;
    transition: right 2s, margin-right 2s, transform 2s;
}

.linguait.deactive {
    right:5%;
    margin-right: -2px;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    -webkit-transition: right 2s, margin-right 2s, -webkit-transform 2s;
    transition: right 2s, margin-right 2s, transform 2s;
}

原文:https://stackoverflow.com/questions/34903414
更新时间:2024-01-15 14:01

最满意答案

使用Vim开发iOS或Mac可以真正强大而快速,特别是如果您使用TDD或需要快速反馈。

但是需要一点点才能使它工作。 你需要知道的几件重要的事情是:

  • 使用xcodebuild命令行工具从一些vimscript运行你的构建和单位。
  • 使用clang_complete插件可以在vim内给你完整的代码完成。
  • 使用ios.vimcocoa.vim插件进行导航。

这是我首选的工作方法。 事实上,我写了ios.vim插件,使更容易为更多的人。


Developing for iOS or Mac with Vim can be really powerful and fast, especially if you use TDD or want quick feedback.

But it takes a bit of finagling to get it working. The few important things you need to know are:

  • Use the xcodebuild command-line tool to run your build and units from some vimscript.
  • Use the clang_complete plugin to give you full code completion from within vim.
  • Use the ios.vim and cocoa.vim plugins for navigation.

This is my preferred method of working. In fact, I wrote the ios.vim plugin to make this easier for more people.

相关问答

更多
  • 看起来好像您将以前安装的Xcode的相关SDK链接到Xcode 6 Beta目录,Xcode 6将能够使用它。 假设您的计算机上仍然有Xcode 5.1.1,请在终端中尝试以下操作: ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platfor ...
  • 与苹果开发者论坛上非常有帮助的人一起,我们试图弄清楚这一点。 我对它不知道该如何运作感到非常盲目,因此从未想过尝试并建立另一个项目并查看是否可行。 我完全专注于会员中心内的证书和个人资料以及xcode中的帐户详细信息。 当我试图建立另一个(随机)项目时,它一气呵成。 这告诉我们它必须与xcode无法编码的特定项目的构建设置有关。 最后,在xcode中,我去了我的目标的生成设置 。 在代码签名部分中,我将Any iOS SDK的值更改为指向我的钥匙串中的特定标识,而不是自动启用它们( iOS Develope ...
  • XCode 4.6无论如何都不支持iOS 7。 您将只能构建将在iOS 7上运行的iOS 6应用程序,但您将无法使用新的iOS 7 SDS功能。 如果您想支持iOS 7功能,则需要使用Xcode 5.这可能还会在您的应用中引起一些视觉问题。 我的建议是迁移到Xcode 5,然后检查你的应用程序中的所有内容是否正常,或者进行必要的更改以便在iOS 7上正常运行。 在任何情况下,如果您发现任何事情都无法按预期运行,您可以安全地从Xcode 5返回到Xcode 4。 XCode 4.6 will not supp ...
  • 使用Vim开发iOS或Mac可以真正强大而快速,特别是如果您使用TDD或需要快速反馈。 但是需要一点点才能使它工作。 你需要知道的几件重要的事情是: 使用xcodebuild命令行工具从一些vimscript运行你的构建和单位。 使用clang_complete插件可以在vim内给你完整的代码完成。 使用ios.vim和cocoa.vim插件进行导航。 这是我首选的工作方法。 事实上,我写了ios.vim插件,使更容易为更多的人。 Developing for iOS or Mac with Vim can ...
  • 要轻松完成此操作,您可以: 1-创建一个继承自UIViewController的UIViewControllerEnhanced视图控制器 2-覆盖它的viewDidLoad方法(或任何init方法,具体取决于你想要的),如下所示: - (void) viewDidLoad { [super viewDidLoad]; NSLog(@"viewDidLoad for class %@", self.className); } 在项目中,在UIViewControllerEnhanced类中 ...
  • 解决问题的办法是检查“IOS 7及更高版本”复选框,然后填写所需的图标。 这很奇怪,因为我的目标是iOS 8.0及以上版本。 不知道这是有意的还是一个错误。 干杯! The solution to the problem was to also check the "IOS 7 and later checkbox" and then fill in the required icons. This is strange, since I am targeting IOS 8.0 and above. No ...
  • 不,根本不需要您只需要使用该开发者ID注册您的手机,然后使用正确的条款签署您的应用程序。 这就是你需要做的一切。 (xcode具有针对未注册和注册用户的精确构建) No, no need at all you just need to register your phone with that developer id and then sign your application with correct provision . that's all you need to do. (xcode have ...
  • 它位于右下角 It's at the bottom right corner
  • 不,您必须更新到更新版本的iOS,或使用bootcamp使用旧版XCode启动Lion。 No, you'll have to update to a newer version of iOS, or use bootcamp to boot to Lion with an older XCode.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)