Advertisement
briank

Kartra Mark Current Page Navigation

Feb 3rd, 2022
1,975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.53 KB | None | 0 0
  1. <script>
  2. /*
  3.  * Adds class "current_page" to navigation links for current Kartra page.
  4.  * Place code in Kartra FOOTER tracking.
  5.  * Author: Brian Katzung <briank@kappacs.com>
  6.  */
  7. jQuery(function () {
  8.     var base = location.toString().replace(/[?#].*/, '');
  9.     jQuery('ul.nav a').each(function () {
  10.     var m = this.href.match(/^(.*?)([?#].*)?$/);
  11.     if (m && (m[1] === base || (m[2] && m[2].indexOf('asset=page') > 0 && m[2].indexOf('id=' + window.global_id) > 0))) $(this).parent().addClass('current_page');
  12.     });
  13. });
  14. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement