javascript - Using flexslider to create a responsive, full width, fixed-height, carousel image-slider -
i'm trying create full width, fixed-height, carousel image-slider home page of website i'm working on.
that is, images scaled fixed-height (matching carousel height (the width doesn't matter)) scales responsively page does. however, want slider of lighter weight/ greater simplicity.
here code far:
(here head)
<head> <!-- flex slider api js --> <link rel="stylesheet" href="flexslider.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="jquery.flexslider.js"></script> <script type="text/javascript" charset="utf-8"> $(window).load(function() { $('.flexslider').flexslider({ animation: "slide", animationloop: false, itemwidth: 360, itemmargin: 5, minitems: 2, maxitems: 4 }); }); </script> <!-- end of flexsliderapi js --> </head>
here body:
<body> <!-- placement of flex slider --> <div class="flex-container"> <div class="flexslider"> <ul class="slides"> <li> <img src="../../local/images/slide1.jpg" /> </li> <li> <img src="../../local/images/slide2.jpg"/> </li> <li> <img src="../../local/images/slide3.jpg" /> </li> <li> <img src="../../local/images/slide 5.jpg" /> </li> </ul> </div> </div> <!-- end placement of flexslider --> </body>
and here css:
.flex-container { width: 100%; height: 300px; } background-color: red; .flex-container ul { margin: 0px; padding: 0px; } .flex-container li { list-style: outside none none; display: inline; } .flexslider .slides img { width: inherit; max-height: inherit; }
thanks ton help. - cody
not snapping height bounds
i don't see in flexslider height. make sure elements same height, either creating sized thumbnails or enforcing height css. might need remove itemwidth
configuration avoid stretching.
not displaying navigation
your html missing navigation elements. think need configure it; pass navigation options:
controlnav: true, directionnav: true, prevtext: "previous", nexttext: "next",
the configuration offercard uses is:
slideshowspeed:7000, animation:'slide', controlnav:true, directionnav:true, pauseonhover:true, direction:'horizontal', reverse:false, animationspeed:2000, prevtext:"< prev", nexttext:"next >", easing:"linear", slideshow:true, itemwidth:800, minitems:1, itemmargin:0
Comments
Post a Comment