stefangabos / Zebra_Pagination

A generic, Twitter Bootstrap compatible, pagination library for automatically generating navigation links

Home Page:https://stefangabos.github.io/Zebra_Pagination/Zebra_Pagination/Zebra_Pagination.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

public/javascript/zebra_pagination.src.js displaying fragment at top of body

kb-freelance opened this issue · comments

When putting the script directly into the page in the footer - it is displaying the #fragment as plain text at the beginning of the body tag...

<body>#tabact6214




  
     ...content...</body>

The JS

$(document).ready(function() {
    // get the hash in the URL (if any)
    var matches = document.location.href.match(/\#(.*)$/);
    // if a hash exists in the URL
    if (matches)
        // iterate through the pagination links
        $('.Zebra_Pagination a').each(function() {
            // reference to the element
            var $element = $(this);
            // attach the hash to every link
            // (remember that the hash is not available server-side and that's why we're doing it client-side)
            $element.attr('href', $element.attr('href') + '#' + matches[1]);
        });
});

shouldn't all this code come before the closing tag?