Skip to content

Commit

Permalink
use DOM mutation observer w/ arrive
Browse files Browse the repository at this point in the history
  • Loading branch information
etcook committed Sep 16, 2014
1 parent 0236e5c commit d4265b3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion public/class-aesop-core.php
Expand Up @@ -292,7 +292,7 @@ public function scripts(){

// core script
wp_enqueue_script('ai-core', AI_CORE_URL.'/public/assets/js/ai-core.min.js', array('jquery'), AI_CORE_VERSION, true);

wp_enqueue_script('arrive', AI_CORE_URL.'/public/includes/libs/arrive-2.0.0.min.js', array('jquery'), AI_CORE_VERSION, true);
}

/**
Expand Down
34 changes: 19 additions & 15 deletions public/includes/components/component-audio.php
Expand Up @@ -49,21 +49,25 @@ function aesop_audio_shortcode($atts, $content = null) {
<?php if ('on' == $atts['viewstart']) { ?>
<script>
jQuery(document).ready(function(){
jQuery('#aesop-audio-<?php echo $unique;?>').waypoint({
offset: '<?php echo $waypoint;?>',
handler: function(direction){
jQuery('#aesop-audio-<?php echo $unique;?> .mejs-playpause-button button').css({'cursor':'pointer'}).click();

}
});
<?php if ('on' == $atts['viewend']) { ?>
jQuery('#aesop-audio-<?php echo $unique;?>').waypoint({
handler: function(direction){
jQuery('#aesop-audio-<?php echo $unique;?> .mejs-playpause-button button').css({'cursor':'pointer'}).click();
}
});
<?php } ?>
});
jQuery('#aesop-audio-<?php echo $unique;?>').arrive('.mejs-audio', function(){

jQuery('#aesop-audio-<?php echo $unique;?>').waypoint({
offset: '<?php echo $waypoint;?>',
handler: function(direction){
jQuery('#aesop-audio-<?php echo $unique;?> .mejs-playpause-button button').css({'cursor':'pointer'}).click();
}
});

<?php if ('on' == $atts['viewend']) { ?>
jQuery('#aesop-audio-<?php echo $unique;?>').waypoint({
handler: function(direction){
jQuery('#aesop-audio-<?php echo $unique;?> .mejs-playpause-button button').css({'cursor':'pointer'}).click();
}
});
<?php } ?>

});
});
</script>
<?php } ?>

Expand Down
16 changes: 16 additions & 0 deletions public/includes/libs/arrive-2.0.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d4265b3

Please sign in to comment.