te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - How can I change the speed of slider using arrow in Slick Carousel? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I change the speed of slider using arrow in Slick Carousel? - Stack Overflow

programmeradmin3浏览0评论

I have created a logo slider which displays similar to marquee. What I want to do is to add next/prev arrows that can accelerate the speed of slider when click next arrow and reverse the slider when click prev arrow. I currently use slick carousel to make it.

Also I have no idea why sometimes my carousel pause for a second then continue, can anyone help me with this?

$(document).ready(function($) {
  $('.marquee-logo').slick({
    autoplay: true,
    infinite: true,
    autoplaySpeed: 0,
    slidesToScroll: 1,
    slidesToShow: 5,
    arrows: false,
    cssEase: 'linear',
    speed: 6500,
    initialSlide: 1,
    draggable: false,
  });
});
<div class="marquee-logo">
  <div class="slider-logo">
    <img src="">
  </div>
  <div class="slider-logo">
    <img src="">
  </div>
  <div class="slider-logo">
    <img src="">
  </div>
  <div class="slider-logo">
    <img src="">
  </div>
  <div class="slider-logo">
    <img src="">
  </div>
</div>

I have created a logo slider which displays similar to marquee. What I want to do is to add next/prev arrows that can accelerate the speed of slider when click next arrow and reverse the slider when click prev arrow. I currently use slick carousel to make it.

Also I have no idea why sometimes my carousel pause for a second then continue, can anyone help me with this?

$(document).ready(function($) {
  $('.marquee-logo').slick({
    autoplay: true,
    infinite: true,
    autoplaySpeed: 0,
    slidesToScroll: 1,
    slidesToShow: 5,
    arrows: false,
    cssEase: 'linear',
    speed: 6500,
    initialSlide: 1,
    draggable: false,
  });
});
<div class="marquee-logo">
  <div class="slider-logo">
    <img src="http://placehold.it/350x150">
  </div>
  <div class="slider-logo">
    <img src="http://placehold.it/350x150">
  </div>
  <div class="slider-logo">
    <img src="http://placehold.it/350x150">
  </div>
  <div class="slider-logo">
    <img src="http://placehold.it/350x150">
  </div>
  <div class="slider-logo">
    <img src="http://placehold.it/350x150">
  </div>
</div>

http://codepen.io/takumi24/pen/JRzEjA

Share Improve this question asked Oct 25, 2016 at 4:41 TakumiTakumi 3551 gold badge7 silver badges19 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

This can be used to make slider slow

 $("#slowbutton").click(function(){

 $('.marquee-logo').slick('unslick');

 $('.marquee-logo').slick({
  autoplay: true,
  infinite: true,
  autoplaySpeed: 0,
  slidesToScroll: 1,
  slidesToShow: 5,
  arrows: false,
  cssEase: 'linear',
  speed: 10000,
  initialSlide: 1,
  draggable: false,
  });});

This for making faster

  $("#nextbutton").click(function(){
  $('.marquee-logo').slick('unslick');

 $('.marquee-logo').slick({
  autoplay: true,
  infinite: true,
  autoplaySpeed: 0,
  slidesToScroll: 1,
  slidesToShow: 5,
  arrows: false,
  cssEase: 'linear',
  speed: 300,
  initialSlide: 1,
  draggable: false,
  });
});

http://codepen.io/anon/pen/yawgra

On button click first destroy the slider and add slider again with increased/decreased speed

You can also try by this $('.marquee-logo').slick('slickSetOption', 'speed', 500,true); with out destroying the slider

But speed change by slickSetOption method cause a delay:issue https://github./kenwheeler/slick/issues/2334

User XZY's answer worked for me. While playing with it I also noticed that slick (at least in the implementation I was using) exposes an options property which is modifiable. So the below might work as well:

var slickSlider = $('.marquee-logo')[0]

slickSlider.slick.options.autoplaySpeed = 500

Just add the SPEED property, that should be it.

$(document).ready(function(){
  $('.your-slider').slick({
    speed: 3000
  });
});

发布评论

评论列表(0)

  1. 暂无评论