-2

I wanted to show 2 different texts in a same location in my website like a news ticker. The effects I want to use are fadeIn and fadeOut. Texts must come to specified area using fadeIn effect, stay there for 3 seconds and then go out using fadeOut. Then the next text will come and this operation must be done infinitive. How can I do it in jQuery? I found this article that is a bit similar to what I want, but it does not cover all my needs.

Text holder:

<div id="holder"></div>
Community
  • 1
  • 1
Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127

2 Answers2

1

is this wha you expecting .....

<html>
<head></head>
<title></title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<style type="text/css">

.textone{
  position: absolute;
}
.texttwo{
  position: absolute;
  display: none;
}

</style>

<body>
 <div class="textone"></div>
 <div class="texttwo"></div>

</body>

<script type="text/javascript">

$(document).ready(function(){
  fadetheText();
  setInterval(fadetheText,500);
});

function fadetheText()
{
  $(".textone").text("news sticker");
  $(".texttwo").text("ANOTHER TEXT")
  $(".textone").fadeOut(500).delay(500).fadeIn(500);
  $(".texttwo").fadeIn(500).delay(500).fadeOut(500);
  }

</script>

</html>

change the time as your need --- > time shows in ms. hope this will help to you.

caldera.sac
  • 4,918
  • 7
  • 37
  • 69
1

$('.bxslider').bxSlider({
  mode: 'fade',
  auto: true,
  pause: 3000,
  controls: false,
  pager: false
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/bxslider/4.2.5/jquery.bxslider.css" rel="stylesheet"/>
<style>
  .bx-wrapper {
    -moz-box-shadow:none;
    -webkit-box-shadow:none;
    box-shadow:none;
    border: none;
    background: transparent;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bxslider/4.2.5/jquery.bxslider.min.js"></script>



<ul class="bxslider"  id="holder">
  <li>some text</li>
  <li>lorem ipsum</li>
  <li>dolor sit</li>
  <li>smet consecuteru</li>
</ul>

You could use bxslider like this

Praveen
  • 827
  • 6
  • 14