所以我有這個iframe,每次用戶點擊下一張幻燈片時,都會更新「data-active-video」屬性的值..我試圖檢查「數據活動視頻」具有爲4的值,並且如果它不改變 「下面THX檢查iframe中是否存在動態屬性值
<div class="video-frame">
<iframe width="560" height="315" src="EZF4iS-XEQ8" frameborder="0" id="active_video_player" allowfullscreen="" data-active-video="4"></iframe>
</div>
和JS SRC」 value..See代碼:
$('.video-frame').find('iframe').each(function() {
if ($(this).attr('data-active-video', '4')) {
// alert('yesssss');
$(this).attr('src', 'http://www.somelink.com');
}
});