如何通过jquery从左到右滑动元素

Aar*_*iba 10 html javascript jquery slide jquery-effects

尝试h3通过jquery将标题向右滑动到此滑块.此滑块默认具有淡入淡出效果,我正在尝试将slideRight效果赋予h3滑块标题.

HTML:

<div id="headslide">
    <ul>
        <li class="post-content">
            <div class="slidshow-thumbnail">
                <a href="#">
                    <img src="http://3.bp.blogspot.com/-h4-nQvZ5-VE/VQ3HLtSS3ZI/AAAAAAAABIc/iaOda5zoUMw/s350-h260-c/girl_with_winter_hat-wallpaper-1024x768.jpg" height="260" width="350"/>
                </a>
            </div>
            <span class="content-margin">
                <p>Cicero famously orated against his p...</p>
                /* Title */
                <h3><a href="#">Download Premium Blogger Templates</a></h3>
                <span class="info">Info</span>
            </span>
        </li>

        <li class="post-content">
            <div class="slidshow-thumbnail">
                <a href="#">
                    <img src="http://3.bp.blogspot.com/-YfkF1u_VB40/VWr5dYf00gI/AAAAAAAABW8/wv2e-Lu4etw/s390-h340-c-h340-c/11071467_807062866056131_872486685669967339_n.jpg" height="260" width="350"/>
                </a>
            </div>
            <span class="content-margin">
                <p>SEO friendly Flat style Custom Fonts.</p>
                /* Title */
                <h3><a href="#">Modern with a pixel-perfect eye</a></h3>
                <span class="info">Info</span>
            </span>
        </li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

我试过这个
$(".content-margin").delay(400).show("h3", { direction: "right" }, 1200);

请看这个小提琴 >>.我试图通过jquery来做到这一点.

有什么建议吗?

Tof*_*ior 1

我相信这已经是 .cycle 所允许的最接近的了。
希望这就是您想要的。
如果您想要其他动画效果,请更改“.content-margin”。

  $('#headslide ul').cycle({
    timeout: 4000,
    pager: '#headslide .pager',
    before: resetMe,
    after: slideMe
});
function resetMe() {
      $(".content-margin").fadeIn();
    $(".content-margin").css( "left", "-=50" )
}

function slideMe() {
  $(".content-margin").animate({
    left: "+=50",
  }, 2000, function() {
  $(".content-margin").fadeOut();
     });
}
Run Code Online (Sandbox Code Playgroud)

我无法运行分叉的小提琴链接,但是当我将代码复制并粘贴到小提琴中时,效果很好。.Cycle 并不真正允许动画,因此您可以使用“之前”和“之后”来调用执行您正在寻找的动画的函数。这只是将 .cycle 视为循环。