Forums / General Questions / JS/CSS thumbnail slider for additional images

JS/CSS thumbnail slider for additional images

Views: 4,233

Results 1 to 20 of 38
26 Mar 2016, 12:56 AM
#1
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

JS/CSS thumbnail slider for additional images

Hi All,

I'm trying to add a simple little slider beneath the main product image for additional images.

I found a pretty easy looking slider here:
http://bootsnipp.com/snippets/3kAkz

If you look at the demo, you have to imagine it shrunk down to fit beneath the big prod image.

Here is a link to where I am trying to put it for now (just above "Related Products"):
http://0stage.justmedicalDOTbiz/Product_Test/Product_Test_1_Images

This slider has 3 components: HTML, CSS, JS

I'm totally lost. Can somebody please help me?

Thanks!

++++++++++

HERE IS WHAT I HAVE DONE SO FAR:

I put the JS into a file (/includes/templates/MY_TEMPLATE/jscript/jscript_myCarousel.js):

$(document).ready(function() {
 
    var cantidadDesaparecidos = 15;
    var itemsxpagina = 4;
    var items = cantidadDesaparecidos / itemsxpagina;
    var resto = cantidadDesaparecidos % itemsxpagina;
    
    //alert(items.toFixed(0));
    //alert(resto);
    
    for(i = 0; i < items; i++){
        //console.log(i);
        $("#myfeed").append('<div class="item"><div class="row-fluid" id="'+i+'">');
         for(j = 0; j < itemsxpagina; j++){
             //console.log(j);
            $('#'+i).append('<div class="span3"><a href="#x" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;" /></a></div>');
         }              
        $("#myfeed").append('</div></div>');            
    }
    
    if(resto > 0){
        $(".carousel-inner").append('<div class="item"><div class="row-fluid" id="resto">');
        for(x = 0; x < resto; x++){
            $("#resto").append('<div class="span3"><a href="#x" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;" /></a></div>');
        }   
        $(".carousel-inner").append('</div></div>');
    }
    
     $('.item:first').addClass('active');
        
    $('#myCarousel').carousel({
        interval: 10000
    });
    
   

});

Then I inserted the HTML into my prod page file (/includes/templates/MY_TEMPLATE/templates/tpl_product_info_display.php)

<!--bof myCarousel Additional Image Slider -->
<div class="container">
	<div class="row">
		<div class="span12">
    	    <div class="well"> 
                <div id="myCarousel" class="carousel slide">      
                <!-- Carousel items -->
                <div class="carousel-inner" id="myfeed">
                    
                
                 
                </div><!--/carousel-inner-->
                 
                <a class="left carousel-control" href="#myCarousel" data-slide="prev">A</a>
                <a class="right carousel-control" href="#myCarousel" data-slide="next">B</a>
                </div><!--/myCarousel-->
                 
            </div><!--/well-->   
		</div>
	</div>
</div>
<!--eof myCarousel Additional Image Slider -->

Last, I added the CSS to the bottom of my file (/includes/templates/MY_TEMPLATE/css/stylesheet.css)

/* myCarousel additional image slider */
.carousel {
    margin-bottom: 0;
	padding: 0 40px 30px 40px;
}
/* Reposition the controls slightly */
.carousel-control {
	left: -12px;
}
.carousel-control.right {
	right: -12px;
}
/* Changes the position of the indicators */
.carousel-indicators {
	right: 50%;
	top: auto;
	bottom: 0px;
	margin-right: -19px;
}
/* Changes the colour of the indicators */
.carousel-indicators li {
	background: #c0c0c0;
}
.carousel-indicators .active {
background: #333333;
}
26 Mar 2016, 9:07 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: JS/CSS thumbnail slider for additional images

Try moving the jscript file to includes/modules/pages/product_info/
Then check your view source

I tried your link and in the source I could not find "myCarousel Additional Image Slider"

Zen-Venom Get Bitten

26 Mar 2016, 2:16 PM
#3
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

kobra:

Try moving the jscript file to includes/modules/pages/product_info/
Then check your view source

I tried your link and in the source I could not find "myCarousel Additional Image Slider"

Something happened! It's wonky... but it's there! Yaaaaahoooo!

26 Mar 2016, 3:48 PM
#4
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

To simplify this thing and get it working, I placed css and js into their own files and a separate index.html to call the others. But still couldn't get it to work, even as a standalone!

I will zip and attach in case anybody wants to play with it: Attachment #16164

I'm going to go back to the page where I got it (http://bootsnipp.com/snippets/3kAkz) and view source there for comparison.

26 Mar 2016, 4:43 PM
#5
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

Not to point out the obvious but you will also need to download bootstrap, which mean you'll be loading the entire bootstrap CSS file for one slider.

Try this, I recommend this for a responsive slider.

slick, the last carousel you'll ever need

Feznizzle:

To simplify this thing and get it working, I placed css and js into their own files and a separate index.html to call the others. But still couldn't get it to work, even as a standalone!

I will zip and attach in case anybody wants to play with it: Attachment #16164

I'm going to go back to the page where I got it (http://bootsnipp.com/snippets/3kAkz) and view source there for comparison.

26 Mar 2016, 4:55 PM
#6
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

Awesome! Giving it a go right now...

26 Mar 2016, 5:53 PM
#7
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

Man, I am dumb. I couldn't get Slick to work either. I followed directions, best I could. sigh

I was trying to use Multiple Items (second demo down). I dropped the Slick folder into the folder with my html index. Here is the code I put in my index.html:

<!doctype html>
<html>
  <head>
  <title>My Now Amazing Webpage</title>
  <link rel="stylesheet" type="text/css" href="slick/slick.css"/>
  <link rel="stylesheet" type="text/css" href="slick/slick-theme.css"/>
  </head>
  <body>

<div class="responsive">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
</div>
				



  <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  <script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
  <script type="text/javascript" src="slick/slick.js"></script>
  <script type="text/javascript" src="slick/slick.min.js"></script>


  <script type="text/javascript">
$('.responsive').slick({
  dots: true,
  infinite: false,
  speed: 300,
  slidesToShow: 4,
  slidesToScroll: 4,
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 3,
        infinite: true,
        dots: true
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    // You can unslick at a given breakpoint now by adding:
    // settings: "unslick"
    // instead of a settings object
  ]
});
  </script>

  </body>
</html>

  </script>
26 Mar 2016, 6:12 PM
#8
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

rename slick.css to stylesheet_slick.css and upload to:
/includes/templates/YOUR_TEMPLATE_FOLDER/css/

rename slick.js to jscript_slick.js and upload to:
/includes/templates/YOUR_TEMPLATE_FOLDER/jscript/

26 Mar 2016, 6:19 PM
#9
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

Where to put the html? I'm happy to continue playing with it on my product page...

And, actually, exactly what html should I use. Should I put it in a separate php module or something, then call it to the product page by using a 'require'?

26 Mar 2016, 6:32 PM
#10
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

insert it right in the /includes/templates/YOUR_TEMPLATE_FOLDER/templates/tpl_product_info_display.php file

<div class="responsive">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
</div>

  <script type="text/javascript">
$('.responsive').slick({
  dots: true,
  infinite: false,
  speed: 300,
  slidesToShow: 4,
  slidesToScroll: 4,
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 3,
        infinite: true,
        dots: true
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    // You can unslick at a given breakpoint now by adding:
    // settings: "unslick"
    // instead of a settings object
  ]
});
  </script>

Feznizzle:

Where to put the html? I'm happy to continue playing with it on my product page...

And, actually, exactly what html should I use. Should I put it in a separate php module or something, then call it to the product page by using a 'require'?

26 Mar 2016, 6:37 PM
#11
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

Done. Looks like I messed something up though....

26 Mar 2016, 6:44 PM
#12
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

No, I did

you need to wrap the script code with document ready

<script type="text/javascript">
(function($) {
$(document).ready(function() {

$('.responsive').slick({
 dots: true,
 infinite: false,
 speed: 300,
 slidesToShow: 4,
 slidesToScroll: 4,
 responsive: [
   {
     breakpoint: 1024,
     settings: {
       slidesToShow: 3,
       slidesToScroll: 3,
       infinite: true,
       dots: true
     }
   },
   {
     breakpoint: 600,
     settings: {
       slidesToShow: 2,
       slidesToScroll: 2
     }
   },
   {
     breakpoint: 480,
     settings: {
       slidesToShow: 1,
       slidesToScroll: 1
     }
   }
   // You can unslick at a given breakpoint now by adding:
   // settings: "unslick"
   // instead of a settings object
 ]
});

 });

}) (jQuery);
 </script>

Feznizzle:

Done. Looks like I messed something up though....

26 Mar 2016, 6:51 PM
#13
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

Still wasn't working so I moved the js to:
includes/modules/pages/product_info/jscript_slick.js

Made a difference, though it is still funky....

26 Mar 2016, 7:05 PM
#14
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

I forget newer version has a separate css file for the theme, that needs to be uploaded as well

26 Mar 2016, 8:02 PM
#15
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

It's working, yipeee!!! Thank you so much!

Now to figure out how to get rid of the tiny buttons below and replace with arrows at side!

And then the SUPER FUN part of getting it integrated with the tpl_modules_additional_images.php.

uuuuug! :(

27 Mar 2016, 8:57 PM
#16
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

Ok I've got it in and working automatically, more or less.

Here is a link where you can see how it works with a bunch of images (scroll):
http://0stage.justmedicalDOTbiz/Product_Test/Product_Test_1_Images

Here is a link where you can see it with only a couple images (no scroll):
http://0stage.justmedicalDOTbiz/index.php?main_page=product_info&cPath=&products_id=159

Here is a link no additional images:
http://0stage.justmedicalDOTbiz/index.php?main_page=product_info&products_id=123

PROBLEM: Zen is trying to apply a column display to additional images. To demonstrate, visit the first link above and scroll left.

I suspect the problem is occurring within the file where I put my code (/includes/templates/MY_TEMPLATE/templates/tpl_modules_additional_images.php).

I feel like I should just be able to say:

<?php echo '<div>' . $list_box_contents . '</div>' . "\n"; ?>

But that breaks the cart. :(

Can somebody tell me how to strip out all the column/row stuff from this?

<?php
/**
 * Module Template:
 * Loaded by product-type template to display additional product images.
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_additional_images.php 3215 2006-03-20 06:05:55Z birdbrain $
 * 
 */

  require(DIR_WS_MODULES . zen_get_module_directory('additional_images.php'));
 ?>
 <?php
 if ($flag_show_product_info_additional_images != 0 && $num_images > 0) {
  ?>

	<div class="responsive">

<?php
if (is_array($list_box_contents) > 0 ) {
 for($row=0;$row<sizeof($list_box_contents);$row++) {
    $params = "";
    //if (isset($list_box_contents[$row]['params'])) $params .= ' ' . $list_box_contents[$row]['params'];
?>

<?php
    for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
      $r_params = "";
      if (isset($list_box_contents[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents[$row][$col]['params'];
     if (isset($list_box_contents[$row][$col]['text'])) {
?>
    <?php echo '<div>' . $list_box_contents[$row][$col]['text'] .  '</div>' . "\n"; ?>

<?php
      }
    }
?>
<br class="clearBoth" />
<?php
  }
}
?> 

	</div>
27 Mar 2016, 9:14 PM
#17
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

you should only have to remove the <br class="clearBoth" />

Feznizzle:

Ok I've got it in and working automatically, more or less.

Here is a link where you can see how it works with a bunch of images (scroll):
http://0stage.justmedicalDOTbiz/Product_Test/Product_Test_1_Images

Here is a link where you can see it with only a couple images (no scroll):
http://0stage.justmedicalDOTbiz/index.php?main_page=product_info&cPath=&products_id=159

Here is a link no additional images:
http://0stage.justmedicalDOTbiz/index.php?main_page=product_info&products_id=123

PROBLEM: Zen is trying to apply a column display to additional images. To demonstrate, visit the first link above and scroll left.

I suspect the problem is occurring within the file where I put my code (/includes/templates/MY_TEMPLATE/templates/tpl_modules_additional_images.php).

I feel like I should just be able to say:

<?php echo '<div>' . $list_box_contents . '</div>' . "\n"; ?>

But that breaks the cart. :(

Can somebody tell me how to strip out all the column/row stuff from this?

<?php /** * Module Template: * Loaded by product-type template to display additional product images. * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_modules_additional_images.php 3215 2006-03-20 06:05:55Z birdbrain $ * */ require(DIR_WS_MODULES . zen_get_module_directory('additional_images.php')); ?> <?php if ($flag_show_product_info_additional_images != 0 && $num_images > 0) { ?>
<div class="responsive">
<?php if (is_array($list_box_contents) > 0 ) { for($row=0;$row<sizeof($list_box_contents);$row++) { $params = ""; //if (isset($list_box_contents[$row]['params'])) $params .= ' ' . $list_box_contents[$row]['params']; ?> <?php for($col=0;$col<sizeof($list_box_contents[$row]);$col++) { $r_params = ""; if (isset($list_box_contents[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents[$row][$col]['params']; if (isset($list_box_contents[$row][$col]['text'])) { ?>
<?php echo '<div>' . $list_box_contents[$row][$col]['text'] .  '</div>' . "\n"; ?>
<?php } } ?> <br class="clearBoth" /> <?php } } ?>
</div>
27 Mar 2016, 9:20 PM
#18
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

rbarbour:

you should only have to remove the <br class="clearBoth" />

rbarbour for PRESIDENT!!!!!

Wooooo hoooooo!

That has driven me nuts for hours!

27 Mar 2016, 11:48 PM
#19
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: JS/CSS thumbnail slider for additional images

This (I believe) is my last battle to fight!

Now I am trying to reduce wasted space while keeping my product image and any additional images (1-3) flush left.

Referring back to the last of the three links to my site above, you can see I've managed to do that. If you browse around, you will see that all products with only one image are floating left.

Once an additional image is added, width gets added and my main product image centers above width.

But I would like the width to change ONLY if the scroll effect is called.

Notice the margin on the left when only 1 or 2 additional images appear (less than 4, which calls the scroll effect)? That margin is a place holder for the buttons. How do I kill it?

Here is my css...

/* Slider ORIGINAL */
.slick-slider
{
    position: relative;
    padding-left: 35px;

    display: block;
    width:100%;

    -moz-box-sizing: border-box;
         box-sizing: border-box;

    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;

    -webkit-touch-callout: none;
    -khtml-user-select: none;
    -ms-touch-action: pan-y;
        touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

.slick-list
{
    position: relative;

    display: block;
    overflow: hidden;
    width:190px;
    

    margin: 0;
    padding: 0;
}
.slick-list:focus
{
    outline: none;
}
.slick-list.dragging
{
    cursor: pointer;
    cursor: hand;
}

.slick-slider .slick-track,
.slick-slider .slick-list
{
    -webkit-transform: translate3d(0, 0, 0);
       -moz-transform: translate3d(0, 0, 0);
        -ms-transform: translate3d(0, 0, 0);
         -o-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
}

.slick-track
{
    position: relative;
    top: 0;
    left: 0;

    display: block;
}
.slick-track:before,
.slick-track:after
{
    display: table;

    content: '';
}
.slick-track:after
{
    clear: both;
}
.slick-loading .slick-track
{
    visibility: hidden;
}

.slick-slide
{
    display: none;
    float: left;

    height: 100%;
    min-height: 1px;
    padding-bottom: 5px;
}
[dir='rtl'] .slick-slide
{
    float: right;
}
.slick-slide img
{
    display: block;
}
.slick-slide.slick-loading img
{
    display: none;
}
.slick-slide.dragging img
{
    pointer-events: none;
}
.slick-initialized .slick-slide
{
    display: block;
}
.slick-loading .slick-slide
{
    visibility: hidden;
}
.slick-vertical .slick-slide
{
    display: block;

    height: auto;

    border: 1px solid transparent;
}
.slick-arrow.slick-hidden {
    display: none;
}

/* Slider THEME */
.slick-loading .slick-list
{
    background: #fff url('./ajax-loader.gif') center center no-repeat;
}

/* Icons */
@font-face
{
    font-family: 'slick';
    font-weight: normal;
    font-style: normal;

    src: url('./fonts/slick.eot');
    src: url('./fonts/slick.eot?#iefix') format('embedded-opentype'), url('./fonts/slick.woff') format('woff'), url('./fonts/slick.ttf') format('truetype'), url('./fonts/slick.svg#slick') format('svg');
}
/* Arrows */
.slick-prev,
.slick-next
{
    font-size: 0;
    font-weight: bold;
    line-height: 0;

    position: absolute;
    top: 50%;

    display: block;

    width: 30px;
    height: 30px;
    padding: 0;
    margin-top: -10px\9; /*lte IE 8*/
    -webkit-transform: translate(0, -50%);
    -ms-transform: translate(0, -50%);
    transform: translate(0, -50%);

    cursor: pointer;

    color: transparent;
    border-radius: 50%;
    border: 1px solid #d2d2d2;
    outline: none;
    background: #24618E;
}
.slick-prev:hover,
.slick-prev:focus,
.slick-next:hover,
.slick-next:focus
{
    color: transparent;
    border-radius: 50%;
    outline: none;
    background: #24618E;
}
.slick-prev:hover:before,
.slick-prev:focus:before,
.slick-next:hover:before,
.slick-next:focus:before
{
    opacity: 1;
}
.slick-prev.slick-disabled:before,
.slick-next.slick-disabled:before
{
    opacity: .25;
}

.slick-prev:before,
.slick-next:before
{
    font-family: 'slick';
    font-size: 20px;
    font-weight: bold;
    line-height: 1;

    opacity: .75;
    color: white;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.slick-prev
{
    left: 0px;
}
[dir='rtl'] .slick-prev
{
    right: -25px;
    left: auto;
}
.slick-prev:before
{
    content: '<';
}
[dir='rtl'] .slick-prev:before
{
    content: '>';
}

.slick-next
{
    right: -1px;
}
[dir='rtl'] .slick-next
{
    right: auto;
    left: -25px;
}
.slick-next:before
{
    content: '>';
}
[dir='rtl'] .slick-next:before
{
    content: '<';
}

/* Dots
.slick-slider
{
    margin-bottom: 30px;
}

.slick-dots
{
    position: absolute;
    bottom: -45px;

    display: block;

    width: 100%;
    padding: 0;

    list-style: none;

    text-align: center;
}
.slick-dots li
{
    position: relative;

    display: inline-block;

    width: 20px;
    height: 20px;
    margin: 0 5px;
    padding: 0;

    cursor: pointer;
}
.slick-dots li button
{
    font-size: 0;
    line-height: 0;

    display: block;

    width: 20px;
    height: 20px;
    padding: 5px;

    cursor: pointer;

    color: transparent;
    border: 0;
    outline: none;
    background: transparent;
}
.slick-dots li button:hover,
.slick-dots li button:focus
{
    outline: none;
}
.slick-dots li button:hover:before,
.slick-dots li button:focus:before
{
    opacity: 1;
}
.slick-dots li button:before
{
    font-family: 'slick';
    font-size: 6px;
    line-height: 20px;

    position: absolute;
    top: 0;
    left: 0;

    width: 20px;
    height: 20px;

    content: '•';
    text-align: center;

    opacity: .25;
    color: black;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.slick-dots li.slick-active button:before
{
    opacity: .75;
    color: black;
}
 */
28 Mar 2016, 12:13 AM
#20
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: JS/CSS thumbnail slider for additional images

Not exactly sure what your asking :blush:

Can you send screenshots

Feznizzle:

This (I believe) is my last battle to fight!

Now I am trying to reduce wasted space while keeping my product image and any additional images (1-3) flush left.

Referring back to the last of the three links to my site above, you can see I've managed to do that. If you browse around, you will see that all products with only one image are floating left.

Once an additional image is added, width gets added and my main product image centers above width.

But I would like the width to change ONLY if the scroll effect is called.

Notice the margin on the left when only 1 or 2 additional images appear (less than 4, which calls the scroll effect)? That margin is a place holder for the buttons. How do I kill it?

Here is my css...

/* Slider ORIGINAL */
.slick-slider
{
position: relative;
padding-left: 35px;

display: block;
width:100%;

-moz-box-sizing: border-box;
     box-sizing: border-box;

-webkit-user-select: none;
   -moz-user-select: none;
    -ms-user-select: none;
        user-select: none;

-webkit-touch-callout: none;
-khtml-user-select: none;
-ms-touch-action: pan-y;
    touch-action: pan-y;
-webkit-tap-highlight-color: transparent;

}

.slick-list
{
position: relative;

display: block;
overflow: hidden;
width:190px;


margin: 0;
padding: 0;

}
.slick-list:focus
{
outline: none;
}
.slick-list.dragging
{
cursor: pointer;
cursor: hand;
}

.slick-slider .slick-track,
.slick-slider .slick-list
{
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}

.slick-track
{
position: relative;
top: 0;
left: 0;

display: block;

}
.slick-track:before,
.slick-track:after
{
display: table;

content: '';

}
.slick-track:after
{
clear: both;
}
.slick-loading .slick-track
{
visibility: hidden;
}

.slick-slide
{
display: none;
float: left;

height: 100%;
min-height: 1px;
padding-bottom: 5px;

}
[dir='rtl'] .slick-slide
{
float: right;
}
.slick-slide img
{
display: block;
}
.slick-slide.slick-loading img
{
display: none;
}
.slick-slide.dragging img
{
pointer-events: none;
}
.slick-initialized .slick-slide
{
display: block;
}
.slick-loading .slick-slide
{
visibility: hidden;
}
.slick-vertical .slick-slide
{
display: block;

height: auto;

border: 1px solid transparent;

}
.slick-arrow.slick-hidden {
display: none;
}

/* Slider THEME */
.slick-loading .slick-list
{
background: #fff url('./ajax-loader.gif') center center no-repeat;
}

/* Icons */
@font-face
{
font-family: 'slick';
font-weight: normal;
font-style: normal;

src: url('./fonts/slick.eot');
src: url('./fonts/slick.eot?#iefix') format('embedded-opentype'), url('./fonts/slick.woff') format('woff'), url('./fonts/slick.ttf') format('truetype'), url('./fonts/slick.svg#slick') format('svg');

}
/* Arrows */
.slick-prev,
.slick-next
{
font-size: 0;
font-weight: bold;
line-height: 0;

position: absolute;
top: 50%;

display: block;

width: 30px;
height: 30px;
padding: 0;
margin-top: -10px\9; /*lte IE 8*/
-webkit-transform: translate(0, -50%);
-ms-transform: translate(0, -50%);
transform: translate(0, -50%);

cursor: pointer;

color: transparent;
border-radius: 50%;
border: 1px solid #d2d2d2;
outline: none;
background: #24618E;

}
.slick-prev:hover,
.slick-prev:focus,
.slick-next:hover,
.slick-next:focus
{
color: transparent;
border-radius: 50%;
outline: none;
background: #24618E;
}
.slick-prev:hover:before,
.slick-prev:focus:before,
.slick-next:hover:before,
.slick-next:focus:before
{
opacity: 1;
}
.slick-prev.slick-disabled:before,
.slick-next.slick-disabled:before
{
opacity: .25;
}

.slick-prev:before,
.slick-next:before
{
font-family: 'slick';
font-size: 20px;
font-weight: bold;
line-height: 1;

opacity: .75;
color: white;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

}

.slick-prev
{
left: 0px;
}
[dir='rtl'] .slick-prev
{
right: -25px;
left: auto;
}
.slick-prev:before
{
content: '<';
}
[dir='rtl'] .slick-prev:before
{
content: '>';
}

.slick-next
{
right: -1px;
}
[dir='rtl'] .slick-next
{
right: auto;
left: -25px;
}
.slick-next:before
{
content: '>';
}
[dir='rtl'] .slick-next:before
{
content: '<';
}

/* Dots
.slick-slider
{
margin-bottom: 30px;
}

.slick-dots
{
position: absolute;
bottom: -45px;

display: block;

width: 100%;
padding: 0;

list-style: none;

text-align: center;

}
.slick-dots li
{
position: relative;

display: inline-block;

width: 20px;
height: 20px;
margin: 0 5px;
padding: 0;

cursor: pointer;

}
.slick-dots li button
{
font-size: 0;
line-height: 0;

display: block;

width: 20px;
height: 20px;
padding: 5px;

cursor: pointer;

color: transparent;
border: 0;
outline: none;
background: transparent;

}
.slick-dots li button:hover,
.slick-dots li button:focus
{
outline: none;
}
.slick-dots li button:hover:before,
.slick-dots li button:focus:before
{
opacity: 1;
}
.slick-dots li button:before
{
font-family: 'slick';
font-size: 6px;
line-height: 20px;

position: absolute;
top: 0;
left: 0;

width: 20px;
height: 20px;

content: '•';
text-align: center;

opacity: .25;
color: black;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

}
.slick-dots li.slick-active button:before
{
opacity: .75;
color: black;
}
*/