将flex-active类添加到li而不是a/img [英] Adding flex-active class to the li instead of a/img

查看:141
本文介绍了将flex-active类添加到li而不是a/img的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启用controlNav后,我们将获得漂亮的分页列表和一些有用的类,例如flex-active.但是将类添加到链接或图像(启用缩略图控件时).像这样:

When we enable controlNav, we get nice paging list and some usefull class like flex-active. but the class added to the link or image(when thumbnail control enabled). like this:

<ol class="flex-control-nav">
    <li><a class="flex-active">1</a></li>
    <li><a>1</a></li>
</ol>

如何将flex-active类移至li元素而不是a/img元素,以得到如下信息:

How to move flex-active class to the li element instead of a/img element to get something like this:

<ol class="flex-control-nav">
    <li class="flex-active"><a>1</a></li>
    <li><a>1</a></li>
</ol>

编辑:这是我用来通过缩略图控件显示flexslider的脚本:

edit: here the script i used to show flexslider with thumbnail control:

$('.clients-items').flexslider({
    animation: 'slide',
    controlNav: 'thumbnails',
    directionNav: false,
});

推荐答案

请提供您正在使用的jQuery,以获得更精确的答案,但是您可以使用类似的方法吗?

Please provide the jQuery you are using to get more precise answer but could you use something like this?

$('.clients-items').flexslider({
    animation: 'slide',
    controlNav: 'thumbnails',
    directionNav: false,
    start: function(){
        $('.flex-control-nav .flex-active').parent('li').addClass('flex-active').siblings().removeClass('flex‌​-active');
    },
    after: function(){
        $('.flex-control-nav .flex-active').parent('li').addClass('flex-active').siblings().removeClass('flex‌​-active');
    }
});

这篇关于将flex-active类添加到li而不是a/img的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆