Click here to Skip to main content
15,896,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
View
========
HTML
@model IEnumerable<_24X7Hires.Models.Slider>

@{
    ViewBag.Title = "Index";
}

    <title>Basic jQuery Slider - Demo</title>
    <link rel="stylesheet" href="../assets/bjqs.css">
    <link href="~/Content/Style.css" rel="stylesheet" type='text/css'>
    <link href="~/Content/assets/demo.css" rel="stylesheet" />
    <script src="~/Content/assets/js/jquery-1.7.1.min.js"></script>
    <script src="~/Content/assets/js/bjqs-1.3.min.js"></script>

        <div id="container">
            <h2>Slider from Folder</h2>
            <div id="banner-fade">
                <ul class="bjqs">
                    @foreach (var item in Model)
                    {
                        <li>
                            <img src='@Html.DisplayFor(modelItem => item.src)'
                                 title='@Html.DisplayFor(modelItem => item.title)' alt="">
                        </li>

                    }

                </ul>
            </div>

            @*<script class="secret-source" style="display:none;">
                    jQuery(document).ready(function ($) {

                        $('#banner-fade').bjqs({
                            height: 320,
                            width: 620,
                            responsive: true
                        });

                    });
                </script>*@
        </div>
        <script src="~/Content/assets/js/libs/jquery.secret-source.min.js"></script>
        <script>
            jQuery(function ($) {

                $('.secret-source').secretSource({
                    includeTag: false
                });

                $('#banner-fade').bjqs({
                    height: 320,
                    width: 620,
                    responsive: true
                });
            });
        </script>



Controller
===================
C#
public class HomeController : Controller
   {
       public ActionResult Index()
       {
           string[] filePaths = Directory.GetFiles(Server.MapPath("~/Content/assets/img/"));
           List<Slider> files = new List<Slider>();
           foreach (string filePath in filePaths)
           {
               string fileName = Path.GetFileName(filePath);
               files.Add(new Slider
               {
                   title = fileName.Split('.')[0].ToString(),
                   src = "../Content/assets/img/" + fileName
               });
           }
           return View(files);
       }


Model
====================
C#
public class Slider
 {
     public string src { get; set; }
     public string title { get; set; }
 }


What I have tried:

i tried image automatic moving slider.....,,,
now it's running but it will be run in vertically, we expect to run in horizontally
Posted
Updated 22-Sep-16 5:10am

If you are using Basic jquery slider, then I think you need to do

Add animtype: 'slide' to your code

JavaScript
$('#banner-fade').bjqs({
                   animtype: 'slide',
                   height: 320,
                   width: 620,
                   responsive: true
               });


Also of note, basic-jquery-slider/index.html at master · jcobb/basic-jquery-slider · GitHub[^] it appears this plugin is no longer supported, so you would probably be better off choosing a different image slider that meets your needs. A simple google search will show many (probably thousands) of jquery image sliders that you can choose from which are highly customizable and would better meet your needs if this basic jquery slider does not.
 
Share this answer
 
I spent a few seconds to look at the documentation for you (when you have an issue with a third party component, looking at the documentation is always a good place to start)

Basic jQuery Slider Plugin Demos[^]

It seems you need to specify the animtype property.

If you've done that and it still isn't working then you're probably missing some css or something, again refer to the docs.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900