0

i am trying to addClass to another element if the element i am checking is visible, "have display:block" but nothing is happening,

Here is my code

<script type="text/javascript">
    jQuery(document).ready(function() {
        if ($('.mejs-controls:visible')) {
            $('.mejs-captions-text').addClass('mejs-captions-text-move');
        }else{
            $('.mejs-captions-text').removeClass('mejs-captions-text-move');
        }
    });
</script>

Thanks!

krunos
  • 163
  • 1
  • 9

2 Answers2

3

You could probably do something like this:

<script type="text/javascript">
    jQuery(document).ready(function() {
        if ($('.mejs-controls').is(':visible')) {
            $('.mejs-captions-text').addClass('mejs-captions-text-move');
        }else{
            $('.mejs-captions-text').removeClass('mejs-captions-text-move');
        }
    });
</script>
John Boker
  • 82,559
  • 17
  • 97
  • 130
0

Try with if ($('.mejs-controls').is(':visible'))

DrKey
  • 3,365
  • 2
  • 29
  • 46