0
votes

Hello awesome coders,

I'm working on a thumbnail grid with expanding view

example here: http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/

I have added a video section in the expander which gets his video id by a html5 data-attribute which looks like this in HTML

<div id="test" class="videoPlayer"> iframecode here </div>

Now my problem is that if i haven't defined a video id it will give the me the vimeo error iframe ( the one with Sorry we can't find your video ). And now i'm trying to figure out how to display none that video if that iframe code is present. This is my code ( sorry cant get the > and < to work with me here )

    if ( document.getElementById('test').innerHTML === 'iframe width="560" height="315" frameborder="0" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" src="http://player.vimeo.com/video/?title=0&byline=0&portrait=0" /iframe' ){
    document.getElementById('test').css({display:'none'})
    } else {
    //dosomethingelse
     }

I don't even know if this is possible but this was the closest i could get :S

Thanks in advance!

1

1 Answers

1
votes
document.getElementById('test').css({display:'none'})

It doesn't exist such property(it is jQuery), you have to do this instead:

document.getElementById('test').style.display = 'none';

On the other hand, your way to check if the iframe exist isn't valid, try this instead:

if (document.getElementById('test').innerHTML.indexOf('http://player.vimeo.com/video/?title=0&byline=0&portrait=0') !== -1)