Problem is here:
<div id="my-video" style="display:none;">
as you can see, id is static and is the same for all posts. First of all this is not compliant with html standard: tag id must be unique.
As a side effect if you use the id selector in jquery and the id is used a lot of times jquery apply function a lot of times…
So first you have to make id unique, in the loop use:
<div id="my-video-<?php the_ID(); ?>" class="my-video-container" style="display:none;">
For same reason change the code for the play button (you can remove imageID at all):
<a class="video-play-button" href="#"></a>
and change jquery like so:
$('.video-play-button').click(function() {
$(this).closest('.feature-img').find('.my-video-container').show();
$(this).siblings('.featimg').hide();
$(this).hide();
});
Related Posts:
- The correct way to call posts with ajax
- add bootstrap post slider with tabs
- Using the loop to set locations for all posts on a single google map
- Print Current Post Index number within Loop
- Should we trust the post globals?
- How to get posts published between a date and today?
- How set featured posts using checkbox in post edit screen?
- Get first post from wp_query
- Confirmation box when submitting post for review
- Do we still need to include a “if (have_posts())” in templates?
- WP_Query: Why is sticky post not first item in loop?
- Ajax Load More Posts in Category Page
- Query *only* sticky posts
- Display all posts from specific categories on a page
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Skip post in loop and mixin later
- How to show list of posts by author and category?
- Override the default number of posts to show for a single loop?
- get comments and get posts in loop
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- Dynamically update post title in admin page
- Reverse chronology of post listing
- Why do I need to use The Loop on pages (inside page.php etc)?
- posts page – different lengths of excerpt
- WordPress Number of Posts Not Changing With posts_per_page
- how to display full post with pagination on home page
- Getting an alphabetic post list with two letters onclick on letter
- How to load post content on index page using ajax when post title in sidebar is clicked
- Count singular post views automatically
- Looping through posts per category gives same posts for each category
- Find most recent authors
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Display All Sticky Post Before Regular Post
- Cannot access current post’s ID in custom plugin
- Can’t show comments count per post outside loop
- Get the author of the latest revision
- How to have different content in the loop and single
- Specific loop in Shortcode
- Strange switch_to_blog() issue
- Show a list of recently viewed posts to a user
- Multiple loops in same page, without duplicate content
- loop not displaying posts on custom template page
- Repost post on specific date every year
- How to use alternate post layout at key points in post loop?
- POST from jQuery to PHP
- Alternate custom content in the loop
- Working Bootstrap Carousel Conversion to WP – Technical Questions
- Showing random content / pictures from earlier posts in a sticky post?
- Search widget breaks when using multiple loops?
- “Uncaught SyntaxError: Unexpected token
- Get all Youtube video’s from posts and embed them on a different page
- How to Display Post View Count
- Add confirmation popup on “Move to Trash”
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- Display Latest Post from all Categories
- Auto Refresh Post List after X seconds
- How do I use Ajax to show the new posts realtime, on the frontpage
- custom wordpress post loop – hide iframe content
- Double count view in archive.php
- Divide Loop Into Days & Categories
- Converting multiple loops into one single loop with pagination
- Display posts with comments closed, with pagination?
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- While in “the loop”, detect if a post is the most recent
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- Different style for most recent article
- Contact form 7 post loop [closed]
- Differentiate between posts and pages in search results
- How to create a load more post entries like Twitter?
- Disable Jquery UI post tabs
- Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
- Loop through all product posts?
- How to display different number of posts
- If Specific Post, Link Elsewhere
- How to filter posts that belong to a specific category only if that is the only category
- WP Query – duplicated posts once including tags in search results
- jQuery inluclude still seems ncessary for script to work within post
- Most recent post from another database
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- get_next_post() and get_previous_post() return wrong posts
- Show all posts in sidebar in single.php
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Avoid duplicate post from same Taxonomy
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Display post from current category and same tag?
- Alternate row and columns every X posts
- page.php showing loop of posts and not page content
- Inserting custom data to the_post() during loop
- Adding specific post category between posts in loop
- Display post category in foreach loop with category link
- How To Get Posts With A Specific Word
- Best way to assign post position in a news site homepage? (no categories, no sticky posts)
- How do I restart my loop with get_next_post()?
- Ajax load more button in Recent posts widget
- Ajax Dynamic Archives not showing correct results
- WP_Query with ajax handler returns the same posts