user3805875
user3805875

Reputation: 53

Infinite Ajax Scroll jQuery - Update title on scroll / pageChange

Is there any possibility to get the TITLE in the head to get updated when scrolling?

Im using Infinite Ajax Scroll. http://infiniteajaxscroll.com

var ias = jQuery.ias({
container:  '#posts',
item:       '.post',
pagination: '#pagination',
next:       '.next'
});

jQuery.ias().on('pageChange', function(pageNum, scrollOffset, url) {
    // Update Page Title
});

Upvotes: 1

Views: 279

Answers (1)

p1erstef
p1erstef

Reputation: 394

I met the same issue with Infinite Ajax Scroll. The only solution I found was to extract the title from "data" on the "loaded" event.

ias.on('loaded', function(data, items) {
        var title = data.match(/<title[^>]*>([^<]+)<\/title>/)[1];
        document.title = title.replace(/&amp;/g, '&')
            .replace(/&lt;/g, '<')
            .replace(/&gt;/g, '>')
            .replace(/&quot;/g, '"')
            .replace(/&#039;/g, "'");
    })

Upvotes: 0

Related Questions