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:


<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
      } );
    } );

Use in your page or template in example:

<ul class="slider">


<div class="slider">

Example News module:

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

  Working example

  Comment Form

Click here to open the form


CMS Made Simple - Tutorials, Tips and Tricks - CMSMS

Create your own slider for news articles or images

  Article optimized for CMSMS 2.x

  Last tested in: CMSMS 2.2.7
  Last updated: 29-08-2018
  Comments: 7


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