Custom icon/image for slide navigation control buttons like on viber.com

时光怂恿深爱的人放手 提交于 2019-12-11 20:43:25

问题


I am using flexslider and i want to change the . . . slide navigation control to my own icons or image for each slide. like the slide on http://viber.com if not possible on flexslider in which plugin can i do that.


回答1:


I think you can try this approach by tweaking with some css and js:

First, hide the default navigation bullets of flexslider using css:

.flex-control-nav.flex-control-paging {
    display:none;
}

Second, add your custom navigation html and design it in whatever way you want. But make sure that the number of slides and custom navigation anchors are same. I used icon images for custom navigation:

<div class="custom">
    <img src="https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678131-money-16.png" />
    <img src="https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678131-money-16.png" />
    <img src="https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678131-money-16.png" />
    <img src="https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678131-money-16.png" />
    <img src="https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678131-money-16.png" />
</div>

Now, bind the click event on these custom navigation elements which in turn triggers the click on the default navigation of flexslider which are hidden.

$(document).on('click', '.custom img', function () {
    var index = $('.custom img').index($(this)); //Get the index of clicked navigation element
    var nav = $('.flex-control-nav a')[index]; //Get the navigation element of corresponding index from flexslider.
    $(nav).trigger('click'); //Finally, trigger click
});

Demo : http://jsfiddle.net/lotusgodkk/VC4L3/2/




回答2:


You can use Carousel of flex slider like here: http://flexslider.woothemes.com/thumbnail-slider.html

Of course, you have to replace your icon and change some css of carousel to make your slider the same as viber's slider.



来源:https://stackoverflow.com/questions/24524732/custom-icon-image-for-slide-navigation-control-buttons-like-on-viber-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!