Advertisement
artemsemkin

Rhye HTML5 Template #2

May 10th, 2021
1,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function PJAXUpdateNodes(data) {
  2.   return new Promise((resolve) => {
  3.     const
  4.       $nextContainer = $($.parseHTML(data.next.html)),
  5.       nodesToUpdate = [
  6.         '#page-header',
  7.         '#page-footer',
  8.         '#js-audio-background__options',
  9.         '#js-page-transition-curtain',
  10.         '#page-header .menu li',
  11.         '#page-header .menu-overlay li'
  12.       ]; // selectors of elements that needed to update
  13.  
  14.     $.each(nodesToUpdate, function () {
  15.       const
  16.         $item = $(this),
  17.         $nextItem = $nextContainer.find(this);
  18.  
  19.       // sync attributes if element exist in the new container
  20.       if ($nextItem.length) {
  21.         syncAttributes($nextItem, $item);
  22.       }
  23.     });
  24.  
  25.     resolve(true);
  26.   });
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement