Javascript 函数js中的this.nextSibling
我正在html页面中使用此代码。 单击图像照片媒体时,图像消失,视频iframe显示。它工作得很好,但我想用这段代码创建一个jQuery函数。我不想在HTML中包含JavaScript。有人能帮我吗Javascript 函数js中的this.nextSibling,javascript,jquery,css,nextsibling,Javascript,Jquery,Css,Nextsibling,我正在html页面中使用此代码。 单击图像照片媒体时,图像消失,视频iframe显示。它工作得很好,但我想用这段代码创建一个jQuery函数。我不想在HTML中包含JavaScript。有人能帮我吗 <li class="mix videos"> <div onclick="this.nextSibling.style.display='block'; this.style.display='none'"> <img src="http://
<li class="mix videos">
<div onclick="this.nextSibling.style.display='block'; this.style.display='none'">
<img src="http://img.youtube.com/vi/<?php the_sub_field('youtube'); ?>/0.jpg" class="photo_medias" style="cursor:pointer" />
</div>
<div style="display:none">
<iframe class="youtube" src="//www.youtube.com/embed/<?php the_sub_field('youtube'); ?>" frameborder="0" allowfullscreen></iframe>
</div>
</li>
你能行
或
@mmdwc欢迎您乐于帮助:
$('.mix.videos div').click(function () {
$(this).hide().siblings().show();
});
$('.mix.videos div').click(function () {
$(this).hide();
next_el = $(this).next().length ? $(this).next() : $(this).closest('.mix.videos').children().first();
next_el.show();
});