Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #49025, comment 2


Ignore:
Timestamp:
04/22/2020 05:01:26 PM (6 years ago)
Author:
anonymized_14254218

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #49025, comment 2

    v1 v2  
    1515                                targetHref = target.href;
    1616
    17                                 this.untoggleModal(target.closest('.cover-modal.active'));
    18 
    1917                                if ('' !== target.hash && -1 !== targetHref.indexOf(url)) {
    20                                         setTimeout(function () {
    21                                                 document.getElementById(target.hash.substr(1)).scrollIntoView()
    22                                         }, 700);
     18                                        this.untoggleModal(target.closest('.cover-modal.active'));
     19                                        setTimeout(() => document.getElementById(target.hash.slice(1)).scrollIntoView(), 700);
    2320                                }
    2421                        }
     
    3128
    3229I also prefer `#scrollIntoView` instead of creating a fake element using `#createElement`.
     30
     31**Edit2**
     32Now only untoggles the modal menu if this is a valid anchor, otherwise simply follows the link.