Slider using Jquery in asp.net

Description:-

In this article I have created slider using Jquery. Using Style or JQuery we can created beautiful slider. Here is the demo example to create it.

Using Javascript, JQuery, CSS you can design your Slider also like below. here i have set responsiveness also for screen height and width so in any layout you can open and see slider to fit screen height and width.

Downlaod Required Files:- Files

Default.aspx:-

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>JQuery Slider - CODE SCRATCHER</title>
<!-- it works the same with all jquery version from 1.x to 2.x -->
<script type="text/javascript"src="js/jquery-1.9.1.min.js"></script>
<!-- use jssor.slider.mini.js (39KB) or jssor.sliderc.mini.js (31KB, with caption, no slideshow) or jssor.sliders.mini.js (26KB, no caption, no slideshow) instead for release -->
<!-- jssor.slider.mini.js = jssor.sliderc.mini.js = jssor.sliders.mini.js = (jssor.core.js + jssor.utils.js + jssor.slider.js) -->
<script type="text/javascript"src="js/jssor.core.js"></script>
<script type="text/javascript"src="js/jssor.utils.js"></script>
<script type="text/javascript"src="js/jssor.slider.js"></script>
<script type="text/javascript">
jQuery(document).ready(function ($) {
var options = {
  $AutoPlay: true,    //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
  $AutoPlayInterval: 4000,   //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
  $PauseOnHover: 1,  //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, default value is 1

  $ArrowKeyNavigation: true,  //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
  $SlideDuration: 800,   //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
  $MinDragOffsetToSlide: 20,  //[Optional] Minimum drag offset to trigger slide , default value is 20
  //$SlideWidth: 600,  //[Optional] Width of every slide in pixels, default value is width of 'slides' container
  //$SlideHeight: 300, //[Optional] Height of every slide in pixels, default value is height of 'slides' container
  $SlideSpacing: 0,    //[Optional] Space between each slide in pixels, default value is 0
  $DisplayPieces: 1,   //[Optional] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), the default value is 1
  $ParkingPosition: 0,  //[Optional] The offset position to park slide (this options applys only when slideshow disabled), default value is 0.
  $UISearchMode: 1,  //[Optional] The way (0 parellel, 1 recursive, default value is 1) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc).
  $PlayOrientation: 1, //[Optional] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, default value is 1
  $DragOrientation: 1, //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)

  $ArrowNavigatorOptions: {        //[Optional] Options to specify and enable arrow navigator or not
  $Class: $JssorArrowNavigator$,   //[Requried] Class to create arrow navigator instance
  $ChanceToShow: 1,                //[Required] 0 Never, 1 Mouse Over, 2 Always
  $AutoCenter: 2,          //[Optional] Auto center arrows in parent container, 0 No, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
  $Steps: 1                //[Optional] Steps to go for each navigation request, default value is 1
                },

  $ThumbnailNavigatorOptions: {
  $Class: $JssorThumbnailNavigator$,              //[Required] Class to create thumbnail navigator instance
  $ChanceToShow: 2,                               //[Required] 0 Never, 1 Mouse Over, 2 Always

  $ActionMode: 1,   //[Optional] 0 None, 1 act by click, 2 act by mouse hover, 3 both, default value is 1
  $AutoCenter: 0,   //[Optional] Auto center thumbnail items in the thumbnail navigator container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 3
   $Lanes: 1,               //[Optional] Specify lanes to arrange thumbnails, default value is 1
   $SpacingX: 3,            //[Optional] Horizontal space between each thumbnail in pixel, default value is 0
   $SpacingY: 3,            //[Optional] Vertical space between each thumbnail in pixel, default value is 0
   $DisplayPieces: 10,      //[Optional] Number of pieces to display, default value is 1
   $ParkingPosition: 260,   //[Optional] The offset position to park thumbnail
   $Orientation: 1,         //[Optional] Orientation to arrange thumbnails, 1 horizental, 2 vertical, default value is 1
   $DisableDrag: false//[Optional] Disable drag or not, default value is false
      }
    };

  var jssor_slider1 = new $JssorSlider$("slider1_container", options);

  //responsive code begin
  //you can remove responsive code if you don't want the slider scales while window resizes
  functionScaleSlider() {
     varbodyWidth = document.body.clientWidth;
      if (bodyWidth)
         jssor_slider1.$SetScaleWidth(Math.min(bodyWidth, 800));
      else
         window.setTimeout(ScaleSlider, 30);
        }

  ScaleSlider();

  if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|IEMobile)/)) {
    $(window).bind('resize', ScaleSlider);
      }
    });
</script>
<!-- Arrow Navigator Skin Begin -->
<style type="text/css">
        /*
        .jssora07l              (normal)
        .jssora07r              (normal)
        .jssora07l:hover        (normal mouseover)
        .jssora07r:hover        (normal mouseover)
        .jssora07ldn            (mousedown)
        .jssora07rdn            (mousedown)
        */
.jssora07l, .jssora07r, .jssora07ldn, .jssora07rdn
{
  position: absolute;
  cursor: pointer;
  display: block;
  background: url(Images/a07.png)no-repeat;
  overflow: hidden;
}
.jssora07l
{
  background-position: -5px-35px;
}
.jssora07r
{
  background-position: -65px-35px;
}
.jssora07l:hover
{
  background-position: -125px-35px;
}
.jssora07r:hover
{
  background-position: -185px-35px;
}
.jssora07ldn
{
  background-position: -245px-35px;
}
.jssora07rdn
{
  background-position: -305px-35px;
}
</style>

<!-- Thumbnail Item Skin Begin -->
<style type="text/css">
        /*
        .jssort04 .p            (normal)
        .jssort04 .p:hover      (normal mouseover)
        .jssort04 .pav          (active)
        .jssort04 .pav:hover    (active mouseover)
        .jssort04 .pdn          (mousedown)
        */
.jssort04.w, .jssort04.pav:hover.w
{
  position: absolute;
  width: 60px;
  height: 30px;
  border: #0099FF1pxsolid;
}
*html.jssort04.w
{
  width: /**/62px;
  height: /**/32px;
}
.jssort04.pdn.w, .jssort04.pav.w
{
  border-style: solid;
}
.jssort04.c
{
  width: 62px;
  height: 32px;
  filter: alpha(opacity=45);
  opacity: .45;
  transition: opacity.6s;
  -moz-transition: opacity.6s;
  -webkit-transition: opacity.6s;
  -o-transition: opacity.6s;
}
.jssort04.p:hover.c, .jssort04.pav.c
{
  filter: alpha(opacity=0);
  opacity: 0;
}
.jssort04.p:hover.c
{
  transition: none;
  -moz-transition: none;
  -webkit-transition: none;
  -o-transition: none;
}
</style>

</head>
<body>
<form id="form1"runat="server">
<div>
<!--Jssor Slider Begin -->
<div id="slider1_container" style="position: relative; margin: 0 auto; top: 0px; left: 0px; width: 800px; height: 300px;">
<!-- Loading Screen -->
<div u="loading" style="position: absolute; top: 0px; left: 0px;">
<div style="filter: alpha(opacity=70); opacity: 0.7; position: absolute; display: block; top: 0px; left: 0px; width: 100%; height: 100%;">
</div>
<div style="position: absolute; display: block; background: url(../img/loading.gif) no-repeat center center;top: 0px; left: 0px; width: 100%; height: 100%;">
</div>
</div>
<!-- Slides Container -->
<div u="slides"style="cursor: move; position: absolute; left: 0px; top: 0px; width: 800px; height: 300px; overflow: hidden;">
<div>
  <img src="Images/1.jpg"/>
  <img u="thumb"src="Images/1.jpg"/>
</div>
<div>
  <img src="Images/2.jpg"/>
  <img u="thumb"src="Images/2.jpg"/>
</div>
<div>
  <img src="Images/3.jpg"/>
  <img u="thumb"src="Images/3.jpg"/>
</div>
<div>
  <img src="Images/4.jpg"/>
  <img u="thumb"src="Images/4.jpg"/>
</div>
</div>
<!-- Arrow Left -->
<span u="arrowleft" class="jssora07l" style="width: 50px; height: 50px; top: 123px;left: 8px;"></span>
<!-- Arrow Right -->
<span u="arrowright" class="jssora07r" style="width: 50px; height: 50px; top: 123px;right: 8px"></span>
<!-- Arrow Navigator Skin End -->
<!--ThumbnailNavigator Skin Begin -->
<div u="thumbnavigator" class="jssort04" style="position: absolute; width: 600px;height: 60px; right: 0px; bottom: 0px;">
<div u="slides"style="bottom: 25px; right: 30px;">
<div u="prototype" class="p" style="position: absolute; width: 62px; height: 32px;top: 0; left: 0;">
<div class="w">
<thumbnail templatestyle="width: 100%; height: 100%; border: none; position: absolute;top: 0; left: 0;"></thumbnailtemplate>
</div>
<div class="c" style="position: absolute; background-color: #000; top: 0; left: 0"></div>
</div>
</div>
<!-- Thumbnail Item Skin End -->
</div>
<!--ThumbnailNavigator Skin End -->
</div>
<!--Jssor Slider End -->
</div>
</form>
</body>
</html>

Related Posts

Previous
Next Post »

1 comments:

comments
Anonymous
May 16, 2018 at 6:58:00 PM GMT+5:30 delete

I'm not sure where you're getting your info, but great topic.
I needs to spend some time learning much more or understanding more.
Thanks for wonderful info I was looking for this information for my mission.

Reply
avatar

Thanks for comments.....