jquery-animate

How to add a certain value to anchor tag?

点点圈 提交于 2019-11-30 08:51:14
I have the following code <a href="" (set value 1)>Inside Link which sets a value</a> <script> $(a).click(function() { i=value of a tag; $('#square').animate({'left': i * 360}); }); </script> And i want to add a value attribute to an anchor tag. How to do it? If you want to add a random attribute for a value, you can use data attributes: <a href="#" data-value="1">Text</a> <script type="text/javascript"> $("a").click(function(){ i=$(this).data("value"); $('#square').animate({'left': i * 360}); }); </script> If you are using HTML5 you can use the data- technique. <a id="target" href="http://foo

How to animate 3d plot_surface in matplotlib

心不动则不痛 提交于 2019-11-30 08:23:40
问题 I have created a 3D plot surface from a file and I'm trying to animate the plot. I have read the examples in the matplotlib webpage and other examples in SO, and notice that I need to create an update function to loop through the values in the file and then create a matplotlib.animation object but I don't understand how to do it. I would appreciate very much if someone could explain me the syntax of the update function and how to use it in the matplotlib.animation object. My data is a

Animating Bootstrap progress bar width with jQuery

自作多情 提交于 2019-11-30 08:08:49
I want to animate a progress bar's width from 0% to 70% over 2.5 seconds. However, the code below immediately changes the width to 70% after a 2.5 second delay. What am I missing? $(".progress-bar").animate({ width: "70%" }, 2500); JSFiddle: http://jsfiddle.net/WEYKL/ VisioN The problem is in default Bootstrap transition effect, which animates any update of the width property. If you switch it off with supressing the corresponding style, it will work fine, e.g.: .progress-bar { -webkit-transition: none !important; transition: none !important; } DEMO: http://jsfiddle.net/WEYKL/1/ IT'S very EASY

Re-ordering div positions with jQuery?

南楼画角 提交于 2019-11-30 07:40:57
问题 I'm trying to mimic the vote-up vote-down system that is on this website. Is there an easy way to move the position of a div in jquery (with animations)? Say I have the following items: <div id="items"> <div id="item1">item 1</div> <div id="item2">item 2</div> <div id="item3">item 3</div> </div> I'd like to be able to call a function which would smoothly move item 3 up one position to: <div id="items"> <div id="item1">item 1</div> <div id="item3">item 3</div> <div id="item2">item 2</div> <

jQuery click toggle animation

笑着哭i 提交于 2019-11-30 07:31:49
问题 I'm trying to learn how to use jQuery, and I've stumbled upon a problem. First off, I will show you the part of the code that causes the problem. HTML <div id="nav"> <div id="button"><p class="scroll" onclick="location.href='#ed';">Education</p></div> <div id="button"><p class="scroll" onclick="location.href='#wxp';">Work Experience</p></div> <div id="button"><p class="scroll" onclick="location.href='#oact';">Other Activities</p></div> <div id="button"><p class="scroll" onclick="window.open(

jQuery Horizontal Scrolling (click and animate)

*爱你&永不变心* 提交于 2019-11-30 07:22:16
I have a series of divs floating to infinity in a horizontal line. I have a fixed width div container them, overflow:hidden. Ultimately, I'd like to press divs/buttons on left and right to scroll through the items (vs. using scrollbar). I am having trouble getting .animate() to work. I want each click to move the items within the list over. It should work similar to Amazons "Customers Who Bought This Item Also Bought" list that you can scroll through in the same manner. I was tempted to try using .mousedown and have it move while holding (similar to true scrolling) but want do this easier

Infinite rotation animation using CSS and Javascript [closed]

北城以北 提交于 2019-11-30 06:57:01
I was going thru some single page website examples and found this: http://alwayscreative.net/ . I am totally amazed by the disc in the background that rotates infinitely. i have looked at some examples but none worked that way. Can anyone tell me how was that implemented. Thanks. CSS3: @keyframes rotate360 { to { transform: rotate(360deg); } } img { animation: 2s rotate360 infinite linear; } /* TODO: Add -vendor-prefixes for different browsers */ <img src="//placehold.it/200x200/cfc?text=Wooo!" /> This example makes infinite rotation very well: div{ -moz-border-radius: 50px/50px; -webkit

Can I use .delay() together with .animate() in jQuery?

强颜欢笑 提交于 2019-11-30 06:39:50
I have this code, which slides open a basket preview on a website I am working on. It stays open if the user is hovered on it, but I want it to have a two second delay before the callback for my hover is triggered. This is just in case the user didn't want the mouse to leave the basket area. Below is the code I am using to animate the basket: $('.cart_button, .cart_module').hover(function(){ $(".cart_module").stop().animate({top:'39px'},{duration:500}); }, function(){ $('.cart_module').stop().animate({top: -cartHeight},{duration:500}) }); Here is the code I tried to use, but had no affect: $('

Transparent PNG animate problem on Internet Explorer

浪尽此生 提交于 2019-11-30 05:43:39
CSS Code: #btn{ background: url(transparent.png) no-repeat; filter: alpha(opacity=0); -moz-opacity: 0; -khtml-opacity: 0; opacity: 0; } JavaScript/jQuery: $("#btn").animate({opacity:1,"margin-left":"-25px"}); I don't have any problem with the code above on Firefox, Chrome and others. But it does not work on any version of Internet Explorer. The problem is the PNG image is rendered strange, background of the transparent PNG looks black. When I remove opacity effect, there is no problem. What is the solution? There is currently no solution for this that I'm aware of. Just have to wait for IE to

how to loop a jquery div animation?

Deadly 提交于 2019-11-30 05:11:39
问题 I’m trying to implement a jQuery function with an infinite loop to animate a div. I can’t figure out how to do it. This is my code: $(document).ready(function() { $('#divers').animate({'margin-top':'90px'},6000).animate({'margin-top':'40px'},6000); }); 回答1: put the code that does the full animation into a function, then pass that function as the callback param to the last animation. Something like... $(document).ready(function() { function animateDivers() { $('#divers').animate( {'margin-top'