Friday, 15 June 2012

javascript - Pagination- Scroll to Top -


I am currently using page computing with the following code. I'm looking for a way to scroll the page to start the list of content on the page switch. Any help would be greatly appreciated, thanks

  (function ($) {$ .fn.customPaginate = function (option) {var paginationContainer = items onToPaginate; ItemsPerPage: 4}; Settings on the settings = {}; $ .extend (settings, defaults, options); itemsPerPage = settings.itemsPerPage; itemsToPaginate = $ (settings.itemsToPaginate); on numberOfPaginationLinks = Math.ceil ((itemsToPaginate.length / ItemsPerPage); $ ("& lt; ul> gt; & lt; / ul & gt;".) PrependTo (paginationContainer); for (Index of Index = 0; Index & LT; numberOfPaginationLinks; Index ++) { PaginationContainer.find ("UL") enclosed ("
  • " + (index + 1) + ' ");} itemsToPaginate.filter (": GT ("+ ( Items PerPage - 1) + ") Hide (); paginationContainer.find. (" Click ", function () {var linkNumber = $ (this) .text (); items itemsToHide = on StoPaginate.filter ("+ ((link number -1) * itemspace) +"); $ .merge (itemsToHide, itemsToPaginate.filter (": GT +" (linkNumber * itemsPerPage) - 1 ) + ")")); ItemsToHide.hide (); Var itemshot = itemspagnet.not (itemone); ItemsToShow.show (); }); }} (JQuery));

    $ ('html, body'). Chetan ({scrollTop: 0}, 800);


  • No comments:

    Post a Comment