Good night everyone, im trying to make a vimeo video stop when a tag are clicked. A modal window are called inside a "while loop". I found a code that use the vimeo api (http://jsfiddle.net/joan_r/dutzh512/) but this works only in my first video, the others doesn't stop when the tag are clicked.

This is how my code are going:

    <script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>


    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $query_args = array(
        'post_type' => 'post',
        'order'   => 'DESC',
        'orderby'   => 'date',
        'paged' => $paged

    $the_query = new WP_Query( $query_args );

    if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); 

        $slug = $post->post_name;

        $thumb_id = get_post_thumbnail_id();
        $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true); 


        <a href="#<?php echo $slug ?>" rel="modal">
            <div class="thumb" style="background-image: url(<?php if (has_post_thumbnail()) { echo $thumb_url[0]; } ?>)">
                <p class="legenda"><?php the_title(); ?></p>

        <div class="window" id="<?php echo $slug ?>">
            <?php the_content(); ?>
            <a class="stop" href="#">STOP</a>           


            var iframe = $('.video-player')[0];
            var player = $f(iframe);

            $('.stop').click(function() {


    <?php endwhile; endif; ?> 

    <?php wp_reset_postdata(); ?>

This are working, but only in the first video. What im doing wrong?

Thank you.


Finally i got the solution:


            jQuery("#mascara").click(function() { 
                $('.video-player').each(function(index) {


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.