MENU

Create your own slider for news articles or images

  Previous article Next article  

I will describe the basics of how to create a slider, you can use it yourself in your CMS Made Simple module templates. Think of rotating summary views of the News or CGBlog modules or rotating company logos in the CMSMS Company Directory module.

  How to use

This feature uses jQuery, so to start you need to call the jQuery library in your template. If you already have it there because another module uses it, you don't need to add it twice!

Download the jQuery Cycle plugin and put it in a folder at your webserver. I used the folder "scripts" here...

Add to the head section of your template:

{cms_jquery}

<script type="text/javascript" src="scripts/jquery.cycle.all.min.js"></script>
  <script type="text/javascript">
    $(document).ready(function() {
      $('.slider').cycle( {
        fx: 'scrollRight',
        timeout: 5000,
        pause: 1,
        cleartypeNoBg: true
      } );
    } );
</script>

Use in your page or template in example:

<ul class="slider">
  <li>...</li>
  <li>...</li>
  <li>...</li>
</ul>

or:

<div class="slider">
  <div>...</div>
  <div>...</div>
  <div>...</div>
</div>

Example News module:

<div class="slider">
  {foreach from=$items item=entry}
    <div class="NewsSummary">
       ...
    </div>
  {/foreach}
</div>

  Working example



Buy Me A Coffee


  Comment Form

ReviewManager

Click here to open the form

ReviewManager

  8 Comments

Buy Me A Coffee

CMS Made Simple - Tutorials, Tips and Tricks - CMSMS

Create your own slider for news articles or images

  Article optimized for CMSMS 2.x

  Author:
  Last tested in: CMSMS 2.2.7
  Last updated: 29-08-2018
  Comments: 8
  http://cms.ms/f56D


Buy Me A Coffee




Advertisement


Ads help me to help you! Thanks!

Ads help me to help you! Buy products from these advertisers!