簡體   English   中英

jQuery圖像翻轉-幻燈片過渡

[英]Jquery image rollover - slide transition

如何使用Jquery在滑行過渡時在懸停時更改圖像? 我在互聯網上進行搜索,但找不到有效的代碼。 我發現的所有代碼都使用fadeIn或fadeOut。 非常感謝你!

這是我找到的代碼,但是它使用淡入和淡出:

<script>
$(function() {
$('.change').mouseenter(function(){
  $(this).slideUp('fast', function(){
    $(this).attr('src', $(this).data('on'));
    $(this).fadeIn();
  });
});

$('.change').mouseleave(function(){
  $(this).slideUp('fast', function(){
    $(this).attr('src', $(this).data('off'));
    $(this).fadeIn();
  });
});
});</script>

和html:

<img class="change" src="images/portofoliu/next.gif" data-on="images/portofoliu/prev.gif" data-off="images/portofoliu/next.gif">
<div id="clickme">
  Click here
</div>
<img id="book" src="book.png" alt="" width="100" height="123" />

$('#clickme').hover(function() {
  $('#book').slideUp('slow', function() {
    // Animation complete.
  });
});

http://jsfiddle.net/GFdW5/3/

http://api.jquery.com/slideUp/

編輯:最終解決方案: http : //jsfiddle.net/hellomynameisluc/frTFw

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM