• Resolved kashee

    (@kashee)


    Hello!

    Depending on which slide of the metaslider (rslider) is being viewed, I want a different header color(black or white). Does anyone have any advice?
    I tried the code below but it isn’t working and wondered if there was a smarter way.
    <script type=”text/javascript”>
    jQuery(document).ready( function($){
    var a=$(“flexslider_751 li#rslides1_s2”);
    if(a.hasClass(“rslides1_on”)){
    a.closest(“#pagewrap”).find(“#site-logo a, #main-nav a”).css(‘cssText’, ‘color:
    black!important’);}
    });

    Thank you so much!

    Kashee

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @kashee,

    The code you have would only check once. There is a hook however that lets you run a function before/after each transition. It would be something like this:

    function kashee_change_color($options, $slider_id, $settings) {
        $options['after'] = "function() { console.log('it works!') }";
        return $options;
    }
    add_filter('metaslider_responsive_slider_parameters', 'kashee_change_color', 10, 3);

    Let me know how that works out.

    • This reply was modified 6 years, 7 months ago by Kevin Batdorf.
    Thread Starter kashee

    (@kashee)

    Dear @kbat82,

    Thank you for your reply!
    I have attempted to hook the code below to footer.php.

    function kashee_change_color($options, '#metaslider_751', $settings) {
        $options['after'] = "function() { console.log('it works!'); }";
        return $options;
    }
    add_filter('metaslider_responsive_slider_parameters', 'kashee_change_color', 10, 3);

    but console.log isn’t throwing any outputs. Is there something I am doing wrong?

    Thank you so much!
    Kashee

    Hi @kashee,

    I think you need to add it to functions.php. Do you see this file?

    Hi @kashee,

    I’m going to mark this as resolved as we didn’t hear back, but please feel free to comment or open a new issue if needed, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘change header color depending on which slide is viewed?’ is closed to new replies.