How to store iframes
-
Hello guys so this is probably my second or third question regarding the same theme in which I’m working.
I already did a function to add as many iframe as I want, and I made possible to show the right content in the right tab(something that was not working that well)
Now what I want is when an user clicks in a different option , the video of the previous tab should stop automatically.Current status:
All the iframes can be reproduced inn the same time, and I dont want that.I actually had an idea about storing the iframes in an array and then when another “option” is selected, the array would show the new iframe in the div containing the video player, as you can imagine, I did not do it, because storing iframes would be like specific Iframes, right? I dont want to just use some iframes from big companies, I want to be able to display any video iframe that I want.
I dont know if m explanation was clear. Is it possible to do it with Javascript, if yes, can you help me with this?
This is my code:
<!-- Menu-tabs) --> <?php $iframe_name = get_post_meta($post->ID, 'Vimeo URL', true); ?> <?php if (!empty($iframe)) : ?> <?php else : ?> <ul class="nav nav-pills nav-justified" id="myTab" role="tablist"> <?php $links = get_post_custom_values( 'Iframe' ); ?> <?php if (is_array($links)) : ?> <?php foreach ($links as $key=>$li) : ?> <li class="nav-item <?php echo $key == 0 ? 'active ' : ''; ?>"> <a class="nav-link " data-toggle="tab" href="#tab<?php echo $key; ?>" role="tab" aria-controls="tab" aria-expanded="true">Option</a> </li> <?php endforeach ; ?> <?php endif; ?> </ul> <div class="tab-content" id="myTabContent"> <!--------------------------------------------------------- Content-tabs / Iframes players ---------------------------------------------------------------------------------> <?php $player = get_post_custom_values( 'Iframe' ); ?> <?php if (is_array($player)) : ?> <?php foreach ($player as $key=>$iframe) : ?> <div class="tab-pane <?php echo $key == 0 ? 'active ' : ''; ?>" id="tab<?php echo $key; ?>" role="tabpanel" aria-labelledby="tab"> <br> <div class="song"> <div class="video-grid"> <?php echo $iframe; ?> </div> </div> </div> <?php endforeach ?>
As you can see if I try to do the first idea(the storing iframes) the iframe is inside the “video-grid” div. What would be the right way to it?.
The page I need help with: [log in to see the link]
- The topic ‘How to store iframes’ is closed to new replies.