admin管理员组文章数量:1336434
I was using jquery/jquery-ui's slideDown()
animation function for a particular task. It now transpires that I will not be able to use jQuery in this project. I also cant use YUI or any other libraries. So I wondering is there a way to perform a slideDown style animation using pure javascript?
Edit: I have to do it without jQuery because I am using selenium to control a webpage and on this particular site adding jQuery to the page breaks event handlers for some reason.
I was using jquery/jquery-ui's slideDown()
animation function for a particular task. It now transpires that I will not be able to use jQuery in this project. I also cant use YUI or any other libraries. So I wondering is there a way to perform a slideDown style animation using pure javascript?
Edit: I have to do it without jQuery because I am using selenium to control a webpage and on this particular site adding jQuery to the page breaks event handlers for some reason.
Share Improve this question edited Dec 29, 2011 at 21:05 Jim_CS asked Dec 29, 2011 at 18:28 Jim_CSJim_CS 4,17213 gold badges46 silver badges81 bronze badges 6- 6 Why not just look at jQuery's implementation? It's just javascript in there. – canon Commented Dec 29, 2011 at 18:29
-
1
If you don't want jQuery, why have you added the
[jQuery]
tag to your question? I've removed it. – Rob W Commented Dec 29, 2011 at 18:30 - @RobW The functionality in question es from jQuery... – canon Commented Dec 29, 2011 at 18:31
- Agree with @antisanity. It's pure javascript in there so it IS possible. The thing is: such decision is cost effective? (to reinvent the wheel) – Alfabravo Commented Dec 29, 2011 at 18:32
- One thing I must point out: If you're being banned from using libraries then ask why and point out that you will end up re-inventing the wheel. – ridecar2 Commented Dec 29, 2011 at 18:33
2 Answers
Reset to default 5You can do slides and animations using CSS3, e.g.
.slidable {
position: relative;
-webkit-animation: Slider 2s ease-in-out;
}
@-webkit-keyframes Slider {
from {
top: 0px;
}
to {
top: 100px;
}
}
Use -moz-
for Firefox. Javascript can do movements as well, just put them in timers, e.g.
var top = 0;
window.Timeout(MoveSomething, 10);
function MoveSomething {
var el = document.getElementById('moveme');
top += 2;
el.style.top = top + 'px';
if (top < 100) window.Timeout(MoveSomething, 10);
}
Just takes coding!
The obvious answer is yes...quick question...couldn't you just do an ASYNC load of jQuery into the document and then use it after the fact, or can you not use it because of other limitations?
Worst case you could rip out the part you needed, but that doesn't make much sense. If you can edit any of the JS you could easily paste jQuery just above your code.
本文标签: Animation with pure javascriptno jqueryStack Overflow
版权声明:本文标题:Animation with pure javascript, no jquery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742309223a2450528.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论