当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Jquery: Trying to combine Click, animate, fadeout, and location

问题描述:

I am trying to figure out how to modify this script to add new functions.

  1. Once the a.fromwork link is clicked, the div.dash should fadeout to the left.
  2. The div#titleMove starts its fadeout and its animate to left.
  3. Location then takes over and you move to the next page.

I have tried a number of things to do this. I need your help, any ideas?

<ul class="crumbs">

<li><a href="<?php bloginfo('url');?>/work/" class="fromwork">&larr; Work</a></li>

<li class="dash">&mdash;</li>

<li><div id="titleMove"><?php the_title(); ?></div></li>

</ul>

// Fade Script

$('.fromwork').click(function(){

var href= $(this).attr('href');

// do animation

$('#titleMove').fadeOut( 200, function(){

// go to link when animation completes

window.location=href;

})

$('body').fadeOut(1000);

// over ride browser following link when clicked

return false;

})

网友答案:

Use .delay() and .animate() using a negative margin-left. Or make sure the parent of li.dash is position:relative;, then position:absolute li.dash and use negative left.

分享给朋友:
您可能感兴趣的文章:
随机阅读: