Jssor Image Slider arrows not showing - javascript
I can't get the arrows on the image slider to appear... I've tried changing the positioning and display but that hasn't worked. Since putting the code on my Index page the only things I've changed are: removing "overflow:hidden" on the div id "jssor_1"; the actual size of the slider (width:500px;height:400px); and the rotation speed of each slide... The code was taken from the "no-jquery.html" file. As you can see on the "background: url" part of the code I've already set the source to the "a02.png".
I also noticed that the left arrow, whilst not visible on the slider, does still work (I can hover over it and click it).
I feel like I'm missing something simple here.
HTML:
<!DOCTYPE HTML>
<html>
<head>
<title>Nightfall Gaming</title>
<link href="C:\Users\Cam\Desktop\NightfallGaming\CSS\Stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body bgcolor="#FFFFFF">
<!--site navbar-->
<div id="navbar">
<nav>
<ul>
<li>Home</li>
<li>Game News</li>
<li>Game Reviews
<ul>
<li>Xbox 360</li>
<li>Xbox One</li>
<li>PS3</li>
<li>PS4</li>
<li>PC</li>
<li>Wii</li>
</ul>
</li>
<li>Contact Us/About Us</li>
</ul>
</nav>
</div>
<!--site logo-->
<div id="logo">
<img src="C:\Users\Cam\Desktop\NightfallGaming\Images\Logo.png" alt="Home">
</div>
<!--mainbody div-->
<div id="mainbody">
<div id="slider">
<script type="text/javascript" src="C:\Users\Cam\Desktop\NightfallGaming\js\jssor.slider.min.js" async></script>
<script>
jssor_1_slider_init = function() {
var jssor_1_SlideoTransitions = [
[{b:0.0,d:600.0,y:-290.0,e:{y:27.0}}],
[{b:0.0,d:1000.0,y:185.0},{b:1000.0,d:500.0,o:-1.0},{b:1500.0,d:500.0,o:1.0},{b:2000.0,d:1500.0,r:360.0},{b:3500.0,d:1000.0,rX:30.0},{b:4500.0,d:500.0,rX:-30.0},{b:5000.0,d:1000.0,rY:30.0},{b:6000.0,d:500.0,rY:-30.0},{b:6500.0,d:500.0,sX:1.0},{b:7000.0,d:500.0,sX:-1.0},{b:7500.0,d:500.0,sY:1.0},{b:8000.0,d:500.0,sY:-1.0},{b:8500.0,d:500.0,kX:30.0},{b:9000.0,d:500.0,kX:-30.0},{b:9500.0,d:500.0,kY:30.0},{b:10000.0,d:500.0,kY:-30.0},{b:10500.0,d:500.0,c:{x:87.50,t:-87.50}},{b:11000.0,d:500.0,c:{x:-87.50,t:87.50}}],
[{b:0.0,d:600.0,x:410.0,e:{x:27.0}}],
[{b:-1.0,d:1.0,o:-1.0},{b:0.0,d:600.0,o:1.0,e:{o:5.0}}],
[{b:-1.0,d:1.0,c:{x:175.0,t:-175.0}},{b:0.0,d:800.0,c:{x:-175.0,t:175.0},e:{c:{x:7.0,t:7.0}}}],
[{b:-1.0,d:1.0,o:-1.0},{b:0.0,d:600.0,x:-570.0,o:1.0,e:{x:6.0}}],
[{b:-1.0,d:1.0,o:-1.0,r:-180.0},{b:0.0,d:800.0,o:1.0,r:180.0,e:{r:7.0}}],
[{b:0.0,d:1000.0,y:80.0,e:{y:24.0}},{b:1000.0,d:1100.0,x:570.0,y:170.0,o:-1.0,r:30.0,sX:9.0,sY:9.0,e:{x:2.0,y:6.0,r:1.0,sX:5.0,sY:5.0}}],
[{b:2000.0,d:600.0,rY:30.0}],
[{b:0.0,d:500.0,x:-105.0},{b:500.0,d:500.0,x:230.0},{b:1000.0,d:500.0,y:-120.0},{b:1500.0,d:500.0,x:-70.0,y:120.0},{b:2600.0,d:500.0,y:-80.0},{b:3100.0,d:900.0,y:160.0,e:{y:24.0}}],
[{b:0.0,d:1000.0,o:-0.4,rX:2.0,rY:1.0},{b:1000.0,d:1000.0,rY:1.0},{b:2000.0,d:1000.0,rX:-1.0},{b:3000.0,d:1000.0,rY:-1.0},{b:4000.0,d:1000.0,o:0.4,rX:-1.0,rY:-1.0}]
];
var jssor_1_options = {
$AutoPlay: true,
$Idle: 4000,
$CaptionSliderOptions: {
$Class: $JssorCaptionSlideo$,
$Transitions: jssor_1_SlideoTransitions,
$Breaks: [
[{d:2000,b:1000}]
]
},
$ArrowNavigatorOptions: {
$Class: $JssorArrowNavigator$
},
$BulletNavigatorOptions: {
$Class: $JssorBulletNavigator$
}
};
var jssor_1_slider = new $JssorSlider$("jssor_1", jssor_1_options);
//responsive code begin
//you can remove responsive code if you don't want the slider scales while window resizes
function ScaleSlider() {
var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;
if (refSize) {
refSize = Math.min(refSize, 600);
jssor_1_slider.$ScaleWidth(refSize);
}
else {
window.setTimeout(ScaleSlider, 30);
}
}
ScaleSlider();
$Jssor$.$AddEvent(window, "load", ScaleSlider);
$Jssor$.$AddEvent(window, "resize", $Jssor$.$WindowResizeFilter(window, ScaleSlider));
$Jssor$.$AddEvent(window, "orientationchange", ScaleSlider);
//responsive code end
};
</script>
<style>
/* jssor slider bullet navigator skin 01 css */
/*
.jssorb01 div (normal)
.jssorb01 div:hover (normal mouseover)
.jssorb01 .av (active)
.jssorb01 .av:hover (active mouseover)
.jssorb01 .dn (mousedown)
*/
.jssorb01 {
position: absolute;
}
.jssorb01 div, .jssorb01 div:hover, .jssorb01 .av {
position: absolute;
/* size of bullet elment */
width: 12px;
height: 12px;
filter: alpha(opacity=70);
opacity: .7;
overflow: hidden;
cursor: pointer;
border: #000 1px solid;
}
.jssorb01 div { background-color: gray; }
.jssorb01 div:hover, .jssorb01 .av:hover { background-color: #d3d3d3; }
.jssorb01 .av { background-color: #fff; }
.jssorb01 .dn, .jssorb01 .dn:hover { background-color: #555555; }
/* jssor slider arrow navigator skin 02 css */
/*
.jssora02l (normal)
.jssora02r (normal)
.jssora02l:hover (normal mouseover)
.jssora02r:hover (normal mouseover)
.jssora02l.jssora02ldn (mousedown)
.jssora02r.jssora02rdn (mousedown)
*/
.jssora02l, .jssora02r {
display: block;
position: absolute;
/* size of arrow element */
width: 55px;
height: 55px;
cursor: pointer;
background: url('C:\Users\Cam\Desktop\NightfallGaming\img\a02.png') no-repeat;
overflow: hidden;
}
.jssora02l { background-position: -3px -33px; }
.jssora02r { background-position: -63px -33px; }
.jssora02l:hover { background-position: -123px -33px; }
.jssora02r:hover { background-position: -183px -33px; }
.jssora02l.jssora02ldn { background-position: -3px -33px; }
.jssora02r.jssora02rdn { background-position: -63px -33px; }
</style>
<div id="jssor_1" style="position: relative; margin: 0 auto; top: 228px; left: -180px; width: 500px; height: 400px;">
<!-- Loading Screen -->
<div data-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>
<div data-u="slides" style="cursor: default; position: relative;
: 0px; left: 0px; width: 800px; height: 400px; overflow: hidden;">
<div data-p="112.50" style="display: none;">
<img data-u="image" src="C:\Users\Cam\Desktop\NightfallGaming\img\001.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/007.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="C:\Users\Cam\Desktop\NightfallGaming\img\003.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/004.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/005.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/006.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/009.jpg" />
</div>
<div data-b="0" data-p="112.50" style="display: none;">
<img data-u="image" src="img/008.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/011.jpg" />
</div>
<div data-p="112.50" style="display: none;">
<img data-u="image" src="img/010.jpg" />
</div>
</div>
<!-- Bullet Navigator -->
<div data-u="navigator" class="jssorb01" style="bottom:16px;right:-8px;">
<div data-u="prototype" style="width:12px;height:12px;"></div>
</div>
<!-- Arrow Navigator -->
<span data-u="arrowleft" class="jssora02l" style="top:0px;left:8px;width:55px;height:55px;" data-autocenter="2"></span>
<span data-u="arrowright" class="jssora02r" style="top:0px;right:8px;width:55px;height:55px;" data-autocenter="2"></span>
</div>
<script>
jssor_1_slider_init();
</script>
</div>
</div>
</body>
</html>
Dont you have to put the two arrow span tages inside the main slider_container tag before your last closing div that wraps the image...
Related
fixing a mobile menu and logo as header for smaller screens
I have a side navigation menu for bigger screens in this file. I want to create a navigation bar for mobile phones and smaller screens below 1024px width. I have tried making the mobile navbar hidden for bigger screens and it just acts up. I need some here is a link to my page I will want it to look like this I got the inspiration of the page from link and they were able to make it responsive. var slideIndex = 0; var slides = document.getElementsByClassName("home-page-slides"); showSlides(); function showSlides() { var slideLength = slides.length; // Fade in the slide setTimeout(function() { if (slideIndex == slideLength) { slideIndex = 0; } slides[slideIndex].classList.add("fadeIn"); }, 10); //Fade out the SLide setTimeout(function() { if (slideIndex == slideLength) { slideIndex = 0; } slides[slideIndex].classList.remove("fadeIn"); }, 3980); slideIndex++; setTimeout(showSlides, 4000); } /*---------------------------------------------------- #Navigation menu -----------------------------------------------------*/ .logo { padding: 8px; margin: 20px 0; } .navbar { height: 100%; width: 300px; position: fixed; z-index: 1; top: 0; left: 0; } .navbar a { display: block; text-decoration: none; font-family: 'Nunito Sans', sans-serif; font-size: 13px; padding: 9px; } ul { padding-left: 0px; margin-left: 0px; } ul li { list-style: none; padding-left: 0px; margin-left: 0px; } .navbarFooter { position: relative; right: 0; left: 0; text-align: center; } .divider { width: 16%; text-align: center; position: relative; display: inline-block; vertical-align: middle; border-bottom: 1px solid rgba(0, 0, 0, 0.3); } .navFContent { position: relative; margin-top: 50px; } /*---------------------------------------------------- #Home Page -----------------------------------------------------*/ .slideshow-container, .main { width: calc(100%-300px); height: 100vh; min-height: 100vh; } .desc-container { position: absolute; bottom: 40px; margin-left: 315px; } .desc { margin: auto; width: 450px; height: 250px; position: relative; } .home-page-slides { width: 100%; height: 100vh; min-height: 100vh; -webkit-transition: all 0.5s linear; -moz-transition: all 0.5s linear; -o-transition: all 0.5s linear; transition: all 0.5s linear; position: absolute; top: 0; right: 0; opacity: 0; } .home-page { height: 100vh; min-height: 100vh; width: 100%; } .home-page-slides img { height: 100vh; min-height: 100vh; width: 100%; background-position: top; } <base href="https://happy-kepler-414939.netlify.app/" /> <!-- insert by SO editor --> <link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght#0,200;0,300;0,400;1,200&display=swap" rel="stylesheet"> <link rel="icon" type="image/png" sizes="" href="logos/favicon2.png"> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/animations.css"> <link rel="stylesheet" href="css/event.css"> <link rel="stylesheet" href="css/restaurant.css"> <link rel="stylesheet" href="css/memorial.css"> <link rel="stylesheet" href="css/venue.css"> <link rel="stylesheet" href="css/portfolio.css"> <link rel="stylesheet" href="css/responsive.css"> <div class="navbar whitebg" id="navbar"> <div id="banner" class="mobile-banner"> <div class="mobile-logo"></div> <div id="mobile" class="mobile-menu"> <a onClick="openNav()"> <div class="open"> <div id="burger" class="burger"> <div class="bun01"></div> <div class="patty"></div> <div class="bun02"></div> </div> </div> </a> </div> </div> <div class="main-nav"> <nav class="menu centertext fontlight"> <ul> <img class="logo" src="logos/mainLogo.png" alt=""> <li><a class="blacktxt" href="index.html">HOME</a></li> <li><a class="blacktxt" href="#services">SERVICES</a></li> <li><a class="blacktxt" href="html/about.html">ABOUT</a></li> <li><a class="blacktxt" href="#testimonials">TESTIMONIALS</a></li> <li><a class="blacktxt" href="html/portfolio.html">OUR PORTFOLIO</a></li> <li><a class="blacktxt" href="html/venue.html">EXCLUSIVE VENUES</a></li> <li><a class="blacktxt" href="#contact">CONTACT</a></li> </ul> </nav> <div class="navbarFooter blacktxt fontlight"> <div class="divider"></div> <div class="navFContent"> <p> +1 (646) 580-7740 </p> <p> info#hillandboyd.com </p> <p> New York, USA. </p> </div> </div> </div> </div> <!-- HOME PAGE CONTENT--> <section id="home-page"> <div class="main"> <div class="home-page"> <div class="slideshow-container"> <div class="home-page-slides"> <img src="Images/eventbg1.jpg" style="width:100%"> <div class="desc-container"> <div class="desc p30 whitebg"> <h6 class="goldtxt f30">Luxury Events</h6> <h2 class="blacktxt f18">WE CREATE BEAUTIFUL EVENTS</h2> <p class="greytxt f15 fontlight">Join us for a “No Question too Small, Large or Outrageous” Chat about All things Bridal! This is your chance to have two industry experts answer your queries on any topic that is keeping you up at night. </p> </div> </div> </div> <div class="home-page-slides"> <img src="Images/restaurantbg1.jpg" style="width:100%"/> <div class="desc-container"> <div class="desc p30 whitebg"> <h6 class="goldtxt f30">Creating Impact</h6> <h2 class="blacktxt f18"> STRATEGY AND SALES</h2> <p class="greytxt f15"></p> </div> </div> </div> <div class="home-page-slides"> <img src="Images/memorialbg1.jpg" style="width:100%"/> <div class="desc-container"> <div class="desc p30 whitebg"> <h6 class="goldtxt f30">Lasting Memories</h6> <h2 class="blacktxt f18">SERVING WITH LOVE</h2> <p class="greytxt f15"></p> </div> </div> </div> </div> </div> </div> </section>
To hide the navigation panel & make the site responsive in mobile view use media query in css #media only screen and (max-width: 736px) { /* css property for phone */ } To animate and view side navigation https://www.w3schools.com/howto/howto_js_sidenav.asp
Several questions regarding, image resizing (viewport)
I am having some Issues with how my images are aligned on my website. 1. I would the images to have equal spacing from the left and the right, meaning centered because currently as you make the browser smaller the right side is a lot bigger than the left. 2. Also as I make the browser smaller the page realigns nice, but when I view it on a mobile device it is very different. You can find my code at https://codepen.io/anon/pen/mpKvMx $("#myinput").keyup(function() { var val = $.trim(this.value); if (val === "") $('img').show(); else { $('img').hide(); val = val.split(" ").join("\\ "); console.log(val) $("img[alt*=" + val + " i]").show(); } }); $(".img").wrap('<div class="alt-wrap"/>'); $(".img").each(function() { $(this).after('<p class="alt">' + $(this).attr('alt') + '</p>'); }) h1 { color: red; } h2 { color:red; } p { font-family: Arial; } body { background-color: grey; } div { text-align: justify; } div img { display: inline-block; width: auto; max-height: 200px; height: auto; } input[type=text] { width: 130px; -webkit-transition: width 0.4s ease-in-out; transition: width 0.4s ease-in-out; } input[type=text]:focus { width: 100%; } .alt-wrap { display: block; position: relative; margin: 20px; color: whitesmoke; border: 1px solid mediumorchid; } .alt-wrap p.alt { position: absolute; opacity: 0; /* hide initially */ left: 0; right: 0; bottom: 0; margin: 0; padding: 15px; font-size: 14px; line-height: 22px; background-color: rgba(0,0,0,0.8); transition: all 300ms ease; transition-delay: 300ms; } .alt-wrap:hover > p.alt { opacity: 1; transition-delay: 0s; } .imgContainer{ float:left; } img { width: 200px !important; } body { background: white !important; } .imgContainer { position: relative; } .image { display: block; width: 100%; height: auto; } .overlay { position: absolute; bottom: 0; left: 0; right: 0; background-color: rgba(0,0,0,0.5); overflow: hidden; width: 0; height: 100%; transition: .5s ease; } .imgContainer:hover .overlay { width: 100%; } .text { white-space: nowrap; color: white; font-size: 20px; position: absolute; overflow: hidden; top: 50%; left: 50%; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); } .dl { margin-top: 400px; } <html> <title>Title</title> <head> <link href="style.css" type="text/css" rel="stylesheet" /> <h1 align=center>Heading</h1> <h2 align=center>Sub-Heading</h2> <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> <input type="text" id="myinput" name="search" placeholder="Search.." style="border-radius: 4px;"> </head> <br> <br> <body> <div class="image123"> <div class="imgContainer"> <img src="https://i.warosu.org/data/biz/img/0063/87/1515861781137.png" alt="Bitcoin"><div class="overlay"><div class="text">Bitcoin</div></div> </div> <div class="imgContainer"> <img src="https://upload.wikimedia.org/wikipedia/commons/b/b7/ETHEREUM-YOUTUBE-PROFILE-PIC.png" alt="Ethereum"><div class="overlay"><div class="text">Ethereum</div></div> </div> <div class="imgContainer"> <img src="https://www.profitconfidential.com/wp-content/uploads/2018/11/ripple-icon-1-300x300.png" alt="Ripple"><div class="overlay"><div class="text">Ripple</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/Bitcoin_Cash.png" alt="Bitcoin Cash"><div class="overlay"><div class="text">Bitcoin Cash</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/ada.png" alt="Cardano"><div class="overlay"><div class="text">Cardano</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/NEM.png" alt="NEM"> <div class="overlay"><div class="text">NEM</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/Litecoin.png" alt="LiteCoin"><div class="overlay"><div class="text">LiteCoin</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/stellar.png" alt="Stellar Lumens"><div class="overlay"><div class="text">Stellar Lumens</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/iota.png" alt="IOTA"><div class="overlay"><div class="text">IOTA</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/dash.png" alt="Dash"><div class="overlay"><div class="text">Dash</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/neo.png" alt="NEO"><div class="overlay"><div class="text">NEO</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/tron.png" alt="Tron"><div class="overlay"><div class="text">Tron</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/monero.png" alt="Monero"><div class="overlay"><div class="text">Monero</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/eos.png" alt="EOS"><div class="overlay"><div class="text">EOS</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/icon.png" alt="ICON"><div class="overlay"><div class="text">ICON</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/bitcoingold.png" alt="Bitcoin Gold"><div class="overlay"><div class="text">Bitcoin Gold</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/qtum.svg" alt="QTUM"><div class="overlay"><div class="text">QTUM</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/ethereum_classic.png" alt="Ethereum Classic"><div class="overlay"><div class="text">Ethereum Classic</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/raiblocks.png" alt="RaiBlocks"><div class="overlay"><div class="text">RaiBlocks</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/lisk.png" alt="Lisk"><div class="overlay"><div class="text">Lisk</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/verge.png" alt="Verge"><div class="overlay"><div class="text">Verge</div></div> </div> <div class="imgContainer"> <img src="http://199.180.133.206/img/omisego.png" alt="OmiseGo"><div class="overlay"><div class="text">OmiseGO</div></div> </div> </div><br> </body> </html>
1) All you need is to add the following css to the element you want to align horizontally: margin: 0 auto; 2) Use media queries, so for example you can have: on mobile: all the images stacked (you may need width:100% on your image container) for wider viewports: images inlined as in your code sample If you are not confortable with media queries please see the following example: https://codepen.io/TrentWalton/pen/kqxDy.
Content Slider Pure CSS
I have code below for a content slider using HTML, CSS and JQuery. Is it possible to get exactly what I have now but using pure CSS only? If its not possible with pure CSS is it possible to do with Vanilla JavaScript with no JQuery? Anything helps, cheers. $(function(){ var scroller = $('#scroller div.innerScrollArea'); var scrollerContent = scroller.children('ul'); scrollerContent.children().clone().appendTo(scrollerContent); var curX = 0; scrollerContent.children().each(function(){ var $this = $(this); $this.css('left', curX); curX += $this.outerWidth(true); }); var fullW = curX / 2; var viewportW = scroller.width(); // Scrolling speed management var controller = {curSpeed:0, fullSpeed:2}; var $controller = $(controller); var tweenToNewSpeed = function(newSpeed, duration) { if (duration === undefined) duration = 600; $controller.stop(true).animate({curSpeed:newSpeed}, duration); }; // Pause on hover scroller.hover(function(){ tweenToNewSpeed(0); }, function(){ tweenToNewSpeed(controller.fullSpeed); }); // Scrolling management; start the automatical scrolling var doScroll = function() { var curX = scroller.scrollLeft(); var newX = curX + controller.curSpeed; if (newX > fullW*2 - viewportW) newX -= fullW; scroller.scrollLeft(newX); }; setInterval(doScroll, 40); tweenToNewSpeed(controller.fullSpeed); }); #scroller { position: absolute; } #scroller .innerScrollArea { overflow: hidden; position: absolute; top: 0; bottom: 0; left: 0; right: 0; } #scroller ul { padding: 0; position: relative; } #scroller li { padding: 0; list-style-type: none; position: absolute; } .circle { width: 250px; height: 250px; position: relative; margin: auto; left: 0; right: 0; top: 0; bottom: 0; border-radius: 50%; background-color:transparent; border-style:solid; border-width:9px; border-color:#006850; } .circle-text { color: #1f497d; font-family:Verdana; font-size: 20.5px; text-align: center; width: 200px; top: 90px; left: 10%; bottom: 0; position: absolute; z-index: 99; } .arrow { width:300px; height:80px; } .flipimage { width:300px; height:80px; -moz-transform: scaleY(-1); -webkit-transform: scaleY(-1); -o-transform: scaleY(-1); transform: scaleY(-1); -ms-filter: fliph; /*IE*/ filter: fliph; /*IE*/ } .everything { /*transform: scale(0.6); } <div class="everything"> <div id="scroller" style="width: 900px; height: 470px; margin: 0 auto;"> <div class="innerScrollArea"> <ul> <li> <br style="line-height:89px;"/> <div class="circle"> <div class="circle-text"> HR Connect<br/>Service<br/>Representative </div> </div> <img class="flipimage" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> </li> <li> <img class="arrow" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> <div class="circle"> <div class="circle-text"> Employee<br/>Relations<br/>Specialist </div> </div> </li> <li> <br style="line-height:89px;"/> <div class="circle"> <div class="circle-text"> Employee<br/>Relations<br/>Manager </div> </div> <img class="flipimage" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> </li> <li> <img class="arrow" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> <div class="circle"> <div class="circle-text"> Director, Employee<br/>Relations &<br/>Well-Being </div> </div> </li> </ul> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </div>
You may use animation , but to keep the whole thing sliding for ever, you will need to clone (or make a redundant copy in HTML) at least of the elements that you see at first in the slider . Else, it would behave as a marquee , living a blank space untill everything slides off the box. Example below: /* all position:absolute removed */ #scroller { overflow:hidden; } #scroller .innerScrollArea { } #scroller ul { padding: 0; position: relative; display:flex;/* UPDATE */ } #scroller li { padding: 0; list-style-type: none; } .circle { width: 250px; height: 250px; position: relative; margin: auto; left: 0; right: 0; top: 0; bottom: 0; border-radius: 50%; background-color:transparent; border-style:solid; border-width:9px; border-color:#006850; } .circle-text { color: #1f497d; font-family:Verdana; font-size: 20.5px; text-align: center; width: 200px; top: 90px; left: 10%; bottom: 0; position: absolute; z-index: 99; } .arrow { width:300px; height:80px; } .flipimage { width:300px; height:80px; -moz-transform: scaleY(-1); -webkit-transform: scaleY(-1); -o-transform: scaleY(-1); transform: scaleY(-1); -ms-filter: fliph; /*IE*/ filter: fliph; /*IE*/ } /* UPDATE for animation */ ul { animation: slidli 9s infinite linear; } ul:hover { animation-play-state:paused; } #keyframes slidli { 100% { transform:translatex(-133.5%);/* this is to be update to the content with to see every element slide once untill copies/clone comes back at same spot */ } } <div class="everything"> <div id="scroller" style="width: 900px; height: 470px; margin: 0 auto;"> <div class="innerScrollArea"> <ul> <li> <br style="line-height:89px;" /> <div class="circle"> <div class="circle-text"> HR Connect<br/>Service<br/>Representative </div> </div> <img class="flipimage" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> </li> <li> <img class="arrow" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> <div class="circle"> <div class="circle-text"> Employee<br/>Relations<br/>Specialist </div> </div> </li> <li> <br style="line-height:89px;" /> <div class="circle"> <div class="circle-text"> Employee<br/>Relations<br/>Manager </div> </div> <img class="flipimage" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> </li> <li> <img class="arrow" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> <div class="circle"> <div class="circle-text"> Director, Employee<br/>Relations &<br/>Well-Being </div> </div> </li> <!-- from here it is a copy of the previous elements . 3 of them might have been enough --> <li> <br style="line-height:89px;" /> <div class="circle"> <div class="circle-text"> HR Connect<br/>Service<br/>Representative </div> </div> <img class="flipimage" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> </li> <li> <img class="arrow" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> <div class="circle"> <div class="circle-text"> Employee<br/>Relations<br/>Specialist </div> </div> </li> <li> <br style="line-height:89px;" /> <div class="circle"> <div class="circle-text"> Employee<br/>Relations<br/>Manager </div> </div> <img class="flipimage" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> </li> <li> <img class="arrow" src="http://res.cloudinary.com/djxai1v1e/image/upload/v1499182382/testarrow_png6fn.png"> <div class="circle"> <div class="circle-text"> Director, Employee<br/>Relations &<br/>Well-Being </div> </div> </li> </ul> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </div> Notice: I used the flex model and droppped the absolute positionning. Main parent can be in absolute if you do need it, children do not.
how to change image size in jssor slider?
I want to change the image size of a jssor slider. I changed the width of slider to 1920px but it does not affect the size of images. How I can change the size of images in Jssor Slider. I am using slider name Different Size Photo Slider which is available on jssor website. Please check the below codes and help me in this matter. <body style="padding:0px; margin:0px; background-color:#fff;font-family:'Open Sans',sans-serif,arial,helvetica,verdana"> <!-- #region Jssor Slider Begin --> <script src="js/jssor.slider-23.1.6.min.js" type="text/javascript"></script> <script type="text/javascript"> jssor_1_slider_init = function() { var jssor_1_SlideshowTransitions = [ {$Duration:1200,$Zoom:11,$Rotate:-1,$Easing:{$Zoom:$Jease$.$InQuad,$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Round:{$Rotate:0.5},$Brother:{$Duration:1200,$Zoom:1,$Rotate:1,$Easing:$Jease$.$Swing,$Opacity:2,$Round:{$Rotate:0.5},$Shift:90}}, {$Duration:1400,x:0.25,$Zoom:1.5,$Easing:{$Left:$Jease$.$InWave,$Zoom:$Jease$.$InSine},$Opacity:2,$ZIndex:-10,$Brother:{$Duration:1400,x:-0.25,$Zoom:1.5,$Easing:{$Left:$Jease$.$InWave,$Zoom:$Jease$.$InSine},$Opacity:2,$ZIndex:-10}}, {$Duration:1200,$Zoom:11,$Rotate:1,$Easing:{$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Round:{$Rotate:1},$ZIndex:-10,$Brother:{$Duration:1200,$Zoom:11,$Rotate:-1,$Easing:{$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Round:{$Rotate:1},$ZIndex:-10,$Shift:600}}, {$Duration:1500,x:0.5,$Cols:2,$ChessMode:{$Column:3},$Easing:{$Left:$Jease$.$InOutCubic},$Opacity:2,$Brother:{$Duration:1500,$Opacity:2}}, {$Duration:1500,x:-0.3,y:0.5,$Zoom:1,$Rotate:0.1,$During:{$Left:[0.6,0.4],$Top:[0.6,0.4],$Rotate:[0.6,0.4],$Zoom:[0.6,0.4]},$Easing:{$Left:$Jease$.$InQuad,$Top:$Jease$.$InQuad,$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Brother:{$Duration:1000,$Zoom:11,$Rotate:-0.5,$Easing:{$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Shift:200}}, {$Duration:1500,$Zoom:11,$Rotate:0.5,$During:{$Left:[0.4,0.6],$Top:[0.4,0.6],$Rotate:[0.4,0.6],$Zoom:[0.4,0.6]},$Easing:{$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Brother:{$Duration:1000,$Zoom:1,$Rotate:-0.5,$Easing:{$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Shift:200}}, {$Duration:1500,x:0.3,$During:{$Left:[0.6,0.4]},$Easing:{$Left:$Jease$.$InQuad,$Opacity:$Jease$.$Linear},$Opacity:2,$Outside:true,$Brother:{$Duration:1000,x:-0.3,$Easing:{$Left:$Jease$.$InQuad,$Opacity:$Jease$.$Linear},$Opacity:2}}, {$Duration:1200,x:0.25,y:0.5,$Rotate:-0.1,$Easing:{$Left:$Jease$.$InQuad,$Top:$Jease$.$InQuad,$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Brother:{$Duration:1200,x:-0.1,y:-0.7,$Rotate:0.1,$Easing:{$Left:$Jease$.$InQuad,$Top:$Jease$.$InQuad,$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2}}, {$Duration:1600,x:1,$Rows:2,$ChessMode:{$Row:3},$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$Brother:{$Duration:1600,x:-1,$Rows:2,$ChessMode:{$Row:3},$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2}}, {$Duration:1600,x:1,$Rows:2,$ChessMode:{$Row:3},$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$Brother:{$Duration:1600,x:-1,$Rows:2,$ChessMode:{$Row:3},$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2}}, {$Duration:1600,y:-1,$Cols:2,$ChessMode:{$Column:12},$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$Brother:{$Duration:1600,y:1,$Cols:2,$ChessMode:{$Column:12},$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2}}, {$Duration:1200,y:1,$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$Brother:{$Duration:1200,y:-1,$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2}}, {$Duration:1200,x:1,$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$Brother:{$Duration:1200,x:-1,$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2}}, {$Duration:1200,y:-1,$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$ZIndex:-10,$Brother:{$Duration:1200,y:-1,$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$ZIndex:-10,$Shift:-100}}, {$Duration:1200,x:1,$Delay:40,$Cols:6,$Formation:$JssorSlideshowFormations$.$FormationStraight,$Easing:{$Left:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$ZIndex:-10,$Brother:{$Duration:1200,x:1,$Delay:40,$Cols:6,$Formation:$JssorSlideshowFormations$.$FormationStraight,$Easing:{$Top:$Jease$.$InOutQuart,$Opacity:$Jease$.$Linear},$Opacity:2,$ZIndex:-10,$Shift:-100}}, {$Duration:1500,x:-0.1,y:-0.7,$Rotate:0.1,$During:{$Left:[0.6,0.4],$Top:[0.6,0.4],$Rotate:[0.6,0.4]},$Easing:{$Left:$Jease$.$InQuad,$Top:$Jease$.$InQuad,$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2,$Brother:{$Duration:1000,x:0.2,y:0.5,$Rotate:-0.1,$Easing:{$Left:$Jease$.$InQuad,$Top:$Jease$.$InQuad,$Opacity:$Jease$.$Linear,$Rotate:$Jease$.$InQuad},$Opacity:2}}, {$Duration:1600,x:-0.2,$Delay:40,$Cols:12,$During:{$Left:[0.4,0.6]},$SlideOut:true,$Formation:$JssorSlideshowFormations$.$FormationStraight,$Assembly:260,$Easing:{$Left:$Jease$.$InOutExpo,$Opacity:$Jease$.$InOutQuad},$Opacity:2,$Outside:true,$Round:{$Top:0.5},$Brother:{$Duration:1000,x:0.2,$Delay:40,$Cols:12,$Formation:$JssorSlideshowFormations$.$FormationStraight,$Assembly:1028,$Easing:{$Left:$Jease$.$InOutExpo,$Opacity:$Jease$.$InOutQuad},$Opacity:2,$Round:{$Top:0.5}}} ]; var jssor_1_options = { $AutoPlay: 1, $FillMode: 5, $SlideshowOptions: { $Class: $JssorSlideshowRunner$, $Transitions: jssor_1_SlideshowTransitions, $TransitionsOrder: 1 }, $BulletNavigatorOptions: { $Class: $JssorBulletNavigator$ } }; var jssor_1_slider = new $JssorSlider$("jssor_1", jssor_1_options); /*responsive code begin*/ /*remove responsive code if you don't want the slider scales while window resizing*/ function ScaleSlider() { var bodywidth = jssor_1_slider.body.clientWidth; if (bodywidth) jssor_1_slider.$ScaleWidth(Math.min(bodyWidth, 1920)); else window.setTimeout(ScaleSlider, 30); } ScaleSlider(); $(window).bind("load", ScaleSlider); $(window).bind("resize", ScaleSlider); $(window).bind("orientationchange", ScaleSlider); /*responsive code end*/ }; </script> <style> /* jssor slider bullet navigator skin 13 css */ /* .jssorb13 div (normal) .jssorb13 div:hover (normal mouseover) .jssorb13 .av (active) .jssorb13 .av:hover (active mouseover) .jssorb13 .dn (mousedown) */ .jssorb13 { position: absolute; } .jssorb13 div, .jssorb13 div:hover, .jssorb13 .av { position: absolute; /* size of bullet elment */ width: 21px; height: 21px; background: url('img/b13.png') no-repeat; overflow: hidden; cursor: pointer; } .jssorb13 div { background-position: -5px -5px; } .jssorb13 div:hover, .jssorb13 .av:hover { background-position: -35px -5px; } .jssorb13 .av { background-position: -65px -5px; } .jssorb13 .dn, .jssorb13 .dn:hover { background-position: -95px -5px; } </style> <div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:1345px;height:500px;overflow:hidden;visibility:hidden;"> <!-- Loading Screen --> <div data-u="loading" style="position:absolute;top:0px;left:0px;background:url('img/loading.gif') no-repeat 50% 50%;background-color:rgba(0, 0, 0, 0.7);"></div> <div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:1345px;height:500px;overflow:hidden;"> <div> <img data-u="image" src="img/3.jpg" /> </div> <div> <img data-u="image" src="img/02.jpg" /> </div> <div> <img data-u="image" src="img/03.jpg" /> </div> <div> <img data-u="image" src="img/04.jpg" /> </div> <div> <img data-u="image" src="img/05.jpg" /> </div> <div> <img data-u="image" src="img/06.jpg" /> </div> <div> <img data-u="image" src="img/07.jpg" /> </div> <div> <img data-u="image" src="img/08.jpg" /> </div> <div> <img data-u="image" src="img/09.jpg" /> </div> <div> <img data-u="image" src="img/10.jpg" /> </div> <div> <img data-u="image" src="img/11.jpg" /> </div> <a data-u="any" href="https://www.jssor.com" style="display:none">slider bootstrap</a> </div> <!-- Bullet Navigator --> <div data-u="navigator" class="jssorb13" style="bottom:16px;right:16px;" data-autocenter="1"> <!-- bullet navigator item prototype --> <div data-u="prototype" style="width:21px;height:21px;"></div> </div> </div> <script type="text/javascript">jssor_1_slider_init();</script> <!-- #endregion Jssor Slider End -->
What you need is to change $FillMode: 5 to $FillMode: 0. This will stretch images to fill full area of slide. Also divs with width:1345px, should be 1920. You can find more here https://www.jssor.com/help/layout.html, under “Fill Mode (Slide)”. I hope this will help.
How to change the dimensions of the Jssor Image Slider without losing it's responsive nature, image aspect ratio, etc. only on iPhone device?
The website I'm developing is responsive in nature i.e. the website design gets adjust according to the device on which it is browsed. I've used Bootstrap framework for it. I'm using Jssor JQuery Image slider in my website. It's working fine and perfect for me on all devices and all popular well-known browsers. The only issue I'm facing is when it is viewed on iPhone the size of sliding images in Jssor slider should get changed to dimensions 460 px * 280 px. In other words, the Jssor image slider should look somewhat bigger than the current size. But while doing this the aspect ratio of the images appearing in slider should be maintained. Also when the website is viewed on iPhone the image slider should occupy the whole horizontal screen. That is the image slider shouldn't have any white space appearing around the slider. Currently two vertical blank bars are appearing on both sides of the slider. Initially when the website is viewed on a browser on PC or laptop the resolution of slider images is 940 px * 370 px and it gets auto adjust as per the size of the device on which it it browsed. The said dimension change should happen only on iPhone and not on any other devices. On other devices it's working absolutely fine and perfect. Also the aspect ratio of the images should not get disturb in this process. For your reference I'm putting below the HTML code and jQuery code of the slider. All the necessary library files have been included. HTML code : <div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 940px; height: 370px; overflow: hidden; "> <div u="loading" style="position: absolute; top: 0px; left: 0px;"> <div style="filter: alpha(opacity=70); opacity:0.7; position: absolute; display: block; background-color: #000000; 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> <div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 940px; height: 370px; overflow: hidden;"> <div> <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Bud_Light_Lime_1413041685.jpg" /> <div u=caption t="*" class="captionOrange" style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> slideshow transition twins </div> </div> <div> <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Finlandia_1413041875.jpg" /> <div u=caption t="*" class="captionOrange" style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> slideshow transition twins </div> </div> <div> <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Three_Olives_1413042332.jpg" /> <div u=caption t="*" class="captionOrange" style="position:absolute;left:350px; bottom: 40px; width:300px; height:30px;"> slideshow transition twins </div> </div> <div> <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Avalon_1413041406.jpg" /> <div u=caption t="*" class="captionOrange" style="position:absolute; left:350px; bottom: 40px; width:300px; height:30px;"> slideshow transition twins </div> </div> <div> <img u="image" src="http://smartrebate.eywaharvest.com/images/brands/Brancott_1413042551.JPG" /> <div u=caption t="*" class="captionOrange" style="position:absolute;left:350px; bottom: 40px; width:300px; height:30px;"> slideshow transition twins </div> </div> </div> <div u="navigator" class="jssorb05" style="position: absolute; bottom: 16px; right: 6px;"> <div u="prototype" style="POSITION: absolute; WIDTH: 16px; HEIGHT: 16px;"></div> </div> <style> .jssorb05 div, .jssorb05 div:hover, .jssorb05 .av { background: url(img/b05.png) no-repeat; overflow: hidden; cursor: pointer; } .jssorb05 div { background-position: -7px -7px; } .jssorb05 div:hover, .jssorb05 .av:hover { background-position: -37px -7px; } .jssorb05 .av { background-position: -67px -7px; } .jssorb05 .dn, .jssorb05 .dn:hover { background-position: -97px -7px; } .jssora12l, .jssora12r, .jssora12ldn, .jssora12rdn { position: absolute; cursor: pointer; display: block; background: url(img/a12.png) no-repeat; overflow: hidden; } .jssora12l { background-position: -16px -37px; } .jssora12r { background-position: -75px -37px; } .jssora12l:hover { background-position: -136px -37px; } .jssora12r:hover { background-position: -195px -37px; } .jssora12ldn { background-position: -256px -37px; } .jssora12rdn { background-position: -315px -37px; } .captionOrange, .captionBlack { color: #fff; font-size: 20px; line-height: 30px; text-align: center; border-radius: 4px; } .captionOrange { background: #EB5100; background-color: rgba(235, 81, 0, 0.6); } .captionBlack { font-size:16px; background: #000; background-color: rgba(0, 0, 0, 0.4); } a.captionOrange, A.captionOrange:active, A.captionOrange:visited { color: #ffffff; text-decoration: none; } a.captionOrange:hover { color: #eb5100; text-decoration: underline; background-color: #eeeeee; background-color: rgba(238, 238, 238, 0.7); } .bricon { background: url(img/browser-icons.png); } </style> <span u="arrowleft" class="jssora12l" style="width: 30px; height: 46px; top: 123px; left: 0px;"></span> <span u="arrowright" class="jssora12r" style="width: 30px; height: 46px; top: 123px; right: 0px"></span> <a style="display: none" href="http://www.jssor.com">javascript</a> </div> jQuery code : <script> jQuery(document).ready(function ($) { var _SlideshowTransitions = [{ $Duration: 1200, $Opacity: 2 }]; var options = { $AutoPlay: 1, $AutoPlaySteps: 1, $Idle: 3000, $PauseOnHover: 1, $ArrowKeyNavigation: true, $SlideDuration: 500, $MinDragOffsetToSlide: 20, $SlideSpacing: 0, $Cols: 1, $Align: 0, $UISearchMode: 1, $PlayOrientation: 1, $DragOrientation: 3, $SlideshowOptions: { $Class: $JssorSlideshowRunner$, $Transitions: _SlideshowTransitions, $TransitionsOrder: 1, $ShowLink: true }, $BulletNavigatorOptions: { $Class: $JssorBulletNavigator$, $ChanceToShow: 2, $Steps: 1, $Rows: 1, $SpacingX: 10, $SpacingY: 10, $Orientation: 1 }, $ArrowNavigatorOptions: { $Class: $JssorArrowNavigator$, $ChanceToShow: 2, $Steps: 1 } }; var jssor_slider1 = new $JssorSlider$("slider1_container", options); function ScaleSlider() { var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth; if (parentWidth) jssor_slider1.$ScaleWidth(Math.min(parentWidth, 940)); else window.setTimeout(ScaleSlider, 30); } ScaleSlider(); if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|IEMobile)/)) { $(window).bind('resize', ScaleSlider); } }); </script>
//Your website jQuery(document).ready(function ($) { //... function ScaleSliderDevices() { var bodyWidth = DEVICE.Screen.width(); if (DEVICE.Screen.osDimVariation()) { bodyWidth = DEVICE.Screen.width() + osWidthOffset(); } jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 940)); }; //... if (DEVICE.mobile()) { $(window).bind('resize', ScaleSliderDevices); } //as the resize event may not fire at the beginning sometimes, please scale slider manually after document load ScaleSliderDevices(); }
Since you are already using bootstrap, why not use bootstraps built in carousel? All the responsive work is done for you. plnkr demo <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li> <li data-target="#carousel-example-generic" data-slide-to="3"></li> </ol> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="http://smartrebate.eywaharvest.com/images/brands/Bud_Light_Lime_1413041685.jpg" /> <div class="carousel-caption"> slideshow transition twins </div> </div> <div class="item"> <img src="http://smartrebate.eywaharvest.com/images/brands/Three_Olives_1413042332.jpg" /> <div class="carousel-caption"> slideshow transition twins </div> </div> <div class="item"> <img src="http://smartrebate.eywaharvest.com/images/brands/Avalon_1413041406.jpg" /> <div class="carousel-caption"> slideshow transition twins </div> </div> <div class="item"> <img src="http://smartrebate.eywaharvest.com/images/brands/Brancott_1413042551.JPG" /> <div class="carousel-caption"> slideshow transition twins </div> </div> </div> <!-- Controls --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div>
Conclusion: added resize specific per devices see: Added device detection https://github.com/matthewhudson/device.js/blob/master/lib/device.js source inside js with small updates made by me to resolve width and height problems on IOS. Added Slider Scale to fit body width not parent width, maybe you will need to compute for parent as well width. //Your website jQuery(document).ready(function ($) { //... function ScaleSliderDevices() { var bodyWidth = DEVICE.Screen.width(); if (DEVICE.Screen.osDimVariation()) { bodyWidth = DEVICE.Screen.width() + osWidthOffset(); } jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 940)); }; //... if (DEVICE.mobile()) { $(window).bind('resize', ScaleSliderDevices); } } add resize event for devices (roation mainly) JSFIDDLE: example does not run on devices use the code in your local website to test it on devices. http://jsfiddle.net/sp75dzaq/13/ You can find comments there with more details.