WordPress.org

Make WordPress Core

Ticket #38395: 38395.3.patch

File 38395.3.patch, 1.9 KB (added by joemcgill, 3 years ago)
  • src/wp-content/themes/twentyseventeen/assets/js/global.js

    diff --git src/wp-content/themes/twentyseventeen/assets/js/global.js src/wp-content/themes/twentyseventeen/assets/js/global.js
    index fa29a19..7d03c74 100644
     
    148148                return 'http://www.w3.org/2000/svg' === ( 'undefined' !== typeof SVGRect && div.firstChild && div.firstChild.namespaceURI );
    149149        }
    150150
     151        /*
     152         * Test if background-attachment: fixed is supported.
     153         * @link http://stackoverflow.com/questions/14115080/detect-support-for-background-attachment-fixed
     154         */
     155        function supportsFixedBackground() {
     156                var el = document.createElement('div'),
     157                        isSupported;
     158
     159                try {
     160                        if ( ! ( 'backgroundAttachment' in el.style ) ) {
     161                                return false;
     162                        }
     163                        el.style.backgroundAttachment = 'fixed';
     164                        isSupported = ( 'fixed' === el.style.backgroundAttachment );
     165                        return isSupported;
     166                }
     167                catch (e) {
     168                        return false;
     169                }
     170        }
     171
    151172        // Fire on document ready.
    152173        $( document ).ready( function() {
    153174
     
    184205                if ( true === supportsInlineSVG() ) {
    185206                        document.documentElement.className = document.documentElement.className.replace( /(\s*)no-svg(\s*)/, '$1svg$2' );
    186207                }
     208
     209                if ( true === supportsFixedBackground() ) {
     210                        document.documentElement.className += ' background-fixed';
     211                }
    187212        });
    188213
    189214        // If navigation menu is present on page, adjust it on scroll and screen resize.
  • src/wp-content/themes/twentyseventeen/style.css

    diff --git src/wp-content/themes/twentyseventeen/style.css src/wp-content/themes/twentyseventeen/style.css
    index 6e8e998..4f8391c 100644
    object { 
    40064006        }
    40074007}
    40084008
    4009 @media screen and ( min-width: 85.45em ) {
    4010 
    4011         .panel-image {
     4009@media screen and ( min-width: 55em ) {
     4010        .background-fixed .panel-image {
    40124011                background-attachment: fixed;
    40134012        }
    40144013}