tags:

views:

26

answers:

1

background

i am actually creating an infinite page scroller in jQuery for my tumblr. i want users to be able to disable this functionality. maybe enable it again if they want, thats later.

problem so far

i can disable the auto loading of new pages using a link that will unbind() the scroll() event. also it sets a variable infiniteScrollingEnabled = false so that my script will not append loaded data to the page.

$("#btnDisable").click(function() {
  $window.unbind("scroll", infiniteScroll);
  $(".loading", postsSelector).fadeOut("slow");
  isLoading = false;
  infiniteScrollEnabled = false;
});

but when u user goes to a new page via a link, infinite scrolling is enabled again. to fix this i guess i need cookies.

solution considered

jQuery cookie plugin

question

how can i find out dynamically what is the domain i shld use? or is there a need to set that option?

A: 

You can get the domain of the current page using standard javascript: window.location.hostname (or window.location.host if you want to include any port that may be specified).

Brenton Alker