Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- /* OUTER CONTAINER */
- .tcontainer {
- width: 100%;
- overflow: hidden; /* Hide scroll bar */
- }
- /* MIDDLE CONTAINER */
- .ticker-wrap {
- width: 100%;
- padding-left: 100%; /* Push contents to right side of screen */
- background-color: #eee;
- }
- /* INNER CONTAINER */
- @keyframes ticker {
- 0% { transform: translate3d(0, 0, 0); }
- 100% { transform: translate3d(-500%, 0, 0); }
- }
- .ticker-move {
- /* Basically move items from right side of screen to left in infinite loop */
- display: inline-block;
- white-space:nowrap;
- animation-iteration-count: infinite;
- animation-timing-function: linear;
- animation-name: ticker;
- animation-duration: 20s;
- }
- .ticker-move:hover{
- animation-play-state: paused; /* Pause scroll on mouse hover */
- }
- /* ITEMS */
- .ticker-item{
- display: inline-block; /* Lay items in a horizontal line */
- padding: 0 2rem;
- }</style>
- <div class="tcontainer"> <div class="ticker-wrap"><div class="ticker-move">
- <div class="ticker-item"><?php
- $args=array(
- 'post_type' => 'post',
- );
- $random_post = new WP_Query ($args);
- if ($random_post->have_posts() ) {
- while ($random_post->have_posts() ) {
- $random_post->the_post();
- echo '<div class="ticker-item"><a href="'.get_the_permalink().'">'.get_the_title().'</a></div>';
- }
- }
- }
- }
- ?>
- <?php wp_reset_postdata(); ?>
- </div>
- </div></div></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement