简体   繁体   English

jQuery文字效果滑入

[英]Jquery text effects slide in

This is the code i am working on Jsfiddle . 这是我在Jsfiddle上工作的代码。 There are three text in my code. 我的代码中有三个文本。 All these texts are sliding from left to right. 所有这些文本都从左向右滑动。 Right now my three text effects are there and they are animating on seperate lines but i want my second and third text on the same line. 现在,我的三个文本效果都在那儿,并且它们在单独的行上设置动画效果,但是我希望我的第二个和第三个文本在同一行上。 So third text instead of coming on different line it should be placed next to text 2 not on seperate line. 因此,第三个文本应该放在文本2旁边,而不是放在单独的行上,而不是放在不同的行上。

 <div id="mainContainer">
 <div id="logo">
  <img id="Img1" src="http://i.share.pho.to/cc9794da_o.png" width="50px" height="50px"/>
 </div>
    <div id="images">
        <img id="introImg" src="http://i.share.pho.to/ebe3afc7_o.png"/>
    </div>

    <div id="headlineText">
        <p id="headline1Txt" >Vintage Lace Turquoise Dress</p>
        <p id="headline2Txt" >Sale rice:$135</p>
        <p id="headline3Txt" >Reg: $150</p>
    </div>
    <div id="ctaBtn">
      <button class="btn btn-primary" type="button">SHOP NOW</button>
    </div>

</div>

updated Fiddle 更新的小提琴

IN HTML 在HTML中

 <div id="mainContainer">

         <div id="logo">
        <img id="Img1" src="http://i.share.pho.to/cc9794da_o.png" width="50px" height="50px"/>
    </div>

         <div id="images">
        <img id="introImg" src="http://i.share.pho.to/ebe3afc7_o.png"/>
    </div>
    <div id="headlineText">
        <p id="headline1Txt" >Sports Cargo Bag</p><br />
        <p id="headline2Txt" >Sale Price $21.99     <span id="headline3Txt" >Reg: $150</span></p><br />



    </div>

    <button class="btn btn-primary" id="ctaBtn" type="button">SHOP NOW</button>

 </div>

IN JS 在JS中

$( document ).ready(function() {
bannerAnimation();
});
function bannerAnimation(){
    //Jquery Animation


    $("#headline1Txt").animate({ left: "320" }, 500, function () {
        $("#headline1Txt").animate({ 'marginLeft': "-=50" }, 200);

    });


    setTimeout(function () {
        $("#headline2Txt").animate({ left: "320" }, 500, function () {
            $("#headline3Txt").animate({ left: "30" }, 500, function () {
                $("#headline3Txt").animate({ left: "10" }, 200);
            });
            $("#headline2Txt").animate({ 'marginLeft': "-=50" }, 200);
        });
    }, 1000);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM