的slideToggle从右到左

的slideToggle从右到左

本文介绍了的slideToggle从右到左的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了这个在看一个教程,但我没有看到选择来使它从右侧到左侧工作。我wan't它被连接到主体的右侧。

I made this looking at a tutorial but I see no option there to make it work from the right side to the left. I wan't it to be attached to the right side of the body.

推荐答案

从:

.slideToggle()动画效果的方法匹配元素的高度。
  这会导致页的较低部分向上或向下滑动,出现以
  透露或隐藏的项目。如果该元素是最初显示,它
  将被隐藏;如果隐藏的,它会显示出来。

所以,这样看来,从侧面做到另一边,是的不可以选项(与法),如果你正在寻找一个教程,你easies的办法是只需添加jQuery用户界面到项目,并使用它的动画的方法。这将离开它一样容易:

So it would appear that doing it from side to side, is not an option (with that method), if you're looking at a tutorial, your easies bet is to just add jQuery UI to your project and use it's animations methods. That will leave it as easy as:

$(this).hide('slide',{direction:'left'},1000); //or show

但是,您可能要学会做没有jQuery用户界面(yaiii),它毕竟不是那么难。你需要打破什么jQuery用户界面(我认为)是干什么的,上线的东西:

However, you may want to learn to do it without jQuery UI (yaiii) and it's not so hard after all. You need to break down what jQuery UI (I assume) is doing, something on the lines of:

$(this).animate({ marginLeft: "100%"} , 1000);

在这两个例子中,你需要更换这个您选择您想要的动画课程的元素,但因为你学习我想我点出来。

On both examples, you need to replace this with your selector for the element you want to animate of course, but since you're learning I thought I'd point it out.

这篇关于的slideToggle从右到左的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 10:40