我使用CSS3创建了滑块以显示我的推荐书。现在我需要使用Jquery为此滑块添加一些动画。但我没有任何想法如何用这个滑块使用Jquery ..什么是适合这个插件。所以任何人都可以告诉我如何将动画添加到此滑块?向此推荐滑块添加动画
任何想法非常感谢。
谢谢。
这里是一个滑块代码的链接:jsfiddle.net/XJVYj/82
我使用CSS3创建了滑块以显示我的推荐书。现在我需要使用Jquery为此滑块添加一些动画。但我没有任何想法如何用这个滑块使用Jquery ..什么是适合这个插件。所以任何人都可以告诉我如何将动画添加到此滑块?向此推荐滑块添加动画
任何想法非常感谢。
谢谢。
这里是一个滑块代码的链接:jsfiddle.net/XJVYj/82
我认为这将是非常困难的找到一个完全符合你的代码的插件。但我可以为你编写jQuery的东西。但是,我会有两个问题。
//编辑
OK现在它工作。我知道它不是很优雅,但我不想更改太多的代码。所以我只需要编辑你的两个css选择器(我评论了旧的一个)。您还想注意,使用此解决方案时,您的旧方法在JavaScript禁用时仍然有效。 jQuery代码如下...
$("div.one").css({"left":0, "opacity":1});
$("div.two").css({"left":300, "opacity":1});
$("div.three").css({"left":600, "opacity":1});
$("input#first").click(function(){
$("div.one").animate({left:0},600);
$("div.two").animate({left:300},600);
$("div.three").animate({left:600},600);
});
$("input#second").click(function(){
$("div.one").animate({left:-300},600);
$("div.two").animate({left:0},600);
$("div.three").animate({left:300},600);
});
$("input#third").click(function(){
$("div.one").animate({left:-600},600);
$("div.two").animate({left:-300},600);
$("div.three").animate({left:0},600);
});
希望它能帮助。 PS:对于一个更清洁的解决方案,你将不得不重新思考一下。一种方法是将所有滑块放入包装中,然后移动此包装而不是移动。
如果更改CSS它可能会花费我的布局..我期待在一次显示3项...并使其从数据库中动态地更改这3项... – TNK
感谢您的答案。当我得到某些东西时,我会看看我能做什么并更新我的答案。 – lukasgeiter
谢谢亲爱的..请让我知道,我们可以使这种情况自动发生与淡化淡出影响。 ? – TNK
尝试使用这些:
有文件字面上就在其中有可以使用的选项脚本文件:
$.tiny.carousel = {
options: {
start: 1, // where should the carousel start?
display: 1, // how many blocks do you want to move at 1 time?
axis: 'x', // vertical or horizontal scroller? (x || y).
controls: true, // show left and right navigation buttons.
pager: false, // is there a page number navigation present?
interval: false, // move to another block on intervals.
intervaltime: 3000, // interval time in milliseconds.
rewind: false, // If interval is true and rewind is true it will play in reverse if the last slide is reached.
animation: true, // false is instant, true is animate.
duration: 1000, // how fast must the animation move in ms?
callback: null // function that executes after every move.
}
};
Secifcally:animation: true, // false is instant, true is animate
。
尝试,当你调用滑块的元件上的动画设置为true(你没有提供的脚本代码,所以我不能为你编辑。)
$('YOUR_SLIDERr').tinycarousel({ animation: true });
这是我的滑块与HTML和CSS ... http://jsfiddle.net/XJVYj/82/ – TNK
任何人都可以告诉我哪个jQuery插件匹配这个滑块...? – TNK