【问题标题】:Dynamic wordpress background Based on Slider images基于 Slider 图像的动态 wordpress 背景
【发布时间】:2015-08-19 06:28:04
【问题描述】:

我在 wordpress 上使用 nivoSlider,我希望我的主页背景根据当前幻灯片图像进行更改! 我没有 javascript 和 jquery 的经验,但我擅长 php / html5 / css3。 谢谢。

【问题讨论】:

    标签: javascript jquery css wordpress nivo-slider


    【解决方案1】:

    WordPress nivo slider 无法编辑滑块更改时的回调(除非您编辑插件,从而破坏与未来版本的兼容性)。但是general jQuery plugin 允许您这样做。设置滑块时你会这样做:

    $('#slider').nivoSlider({
        // [snip]
        afterChange: function(){
            // Get the currently active image
            var active_image = $(".nivo-controlNav .active");
            // Change the class on your element and style that element with CSS
            // E.g. by fetching some attribute with $(active_image).attr()
        },
        // [snip]
    });
    

    【讨论】:

      猜你喜欢
      • 2016-02-04
      • 1970-01-01
      • 1970-01-01
      • 2014-06-15
      • 2021-06-03
      • 2020-10-16
      • 1970-01-01
      • 1970-01-01
      • 2018-08-14
      相关资源
      最近更新 更多