From 19274bb2e356dd05c4b72ce67403e23a08c9b3c3 Mon Sep 17 00:00:00 2001 From: Robin Cornett Date: Thu, 10 Dec 2015 09:14:49 -0500 Subject: [PATCH] Add medium_large image to possible backstretch image sources --- ...ass-displayfeaturedimagegenesis-output.php | 20 +++++++++++++------ includes/js/backstretch-set.js | 11 ++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/includes/class-displayfeaturedimagegenesis-output.php b/includes/class-displayfeaturedimagegenesis-output.php index 0b1dd17..69146d7 100644 --- a/includes/class-displayfeaturedimagegenesis-output.php +++ b/includes/class-displayfeaturedimagegenesis-output.php @@ -114,12 +114,20 @@ class Display_Featured_Image_Genesis_Output { 'fade' => 750, ) ); - $image_id = Display_Featured_Image_Genesis_Common::set_image_id(); - $large = wp_get_attachment_image_src( $image_id, 'large' ); - $output = array( - 'src' => esc_url( $this->item->backstretch[0] ), - 'largesrc' => esc_url( $large[0] ), - 'width' => $large[1], + $image_id = Display_Featured_Image_Genesis_Common::set_image_id(); + $large = wp_get_attachment_image_src( $image_id, 'large' ); + $medium_large = wp_get_attachment_image_src( $image_id, 'medium_large' ); + $output = array( + 'source' => array( + 'backstretch' => esc_url( $this->item->backstretch[0] ), + 'large' => esc_url( $large[0] ), + 'medium_large' => esc_url( $medium_large[0] ), + ), + 'width' => array( + 'backstretch' => $this->item->backstretch[1], + 'large' => $large[1], + 'medium_large' => $medium_large[1], + ), 'height' => (int) $this->displaysetting['less_header'], 'centeredX' => (int) (bool) $backstretch_vars['centeredX'], 'centeredY' => (int) (bool) $backstretch_vars['centeredY'], diff --git a/includes/js/backstretch-set.js b/includes/js/backstretch-set.js index e8fcd69..0b82fc1 100644 --- a/includes/js/backstretch-set.js +++ b/includes/js/backstretch-set.js @@ -13,13 +13,20 @@ function _backstretchHandler() { - var source = window.innerWidth <= plugin.params.width ? plugin.params.largesrc : plugin.params.src, + var source = plugin.params.source.backstretch, $el = $( '.big-leader' ); - if (typeof $el === 'undefined') { + if ( typeof $el === 'undefined' ) { return false; } + if ( window.innerWidth <= plugin.params.width.large ) { + source = plugin.params.source.large; + } + if ( window.innerWidth <= plugin.params.width.medium_large ) { + source = plugin.params.source.medium_large; + } + $el.css( { height: ( $(window).height() ) - ( [ plugin.params.height ] ) + 'px' } );