{"id":1242466,"date":"2017-02-20T14:48:48","date_gmt":"2017-02-20T22:48:48","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/"},"modified":"2017-02-21T13:26:44","modified_gmt":"2017-02-21T21:26:44","slug":"firing-js-after-pagination-to-scroll-to-top-of-element","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/","title":{"rendered":"Firing JS after pagination to scroll to top of element"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I&#8217;m looking for a way to insert some Javascript to scroll to the top of the event list after pagination. Is there a js pagination function that Events Calendar uses that I could use to do that? Right now when the pagination completes I have to scroll back up to the top of the events list and that&#8217;s not really a great user experience. <\/p>\n<p>Hopefully I&#8217;m making sense. <\/p>\n<p>Here&#8217;s an example. I use Toolset to display some other custom post types and after the pagination completes I fire some JS so that it scrolls to the top of the results element:<\/p>\n<pre><code>jQuery( document ).on( &#039;js_event_wpv_pagination_completed&#039;, function( event, data ) {\r\n    jQuery(&#039;html, body&#039;).animate({ scrollTop: jQuery(&#039;#results&#039;).offset().top - 150 }, 500);\r\n});\r\n<\/code><\/pre>\n<p>Do you guys have anything like that? I appreciate your help!<\/p>\n","protected":false},"template":"","class_list":["post-1242466","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Firing JS after pagination to scroll to top of element -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Firing JS after pagination to scroll to top of element -\" \/>\n<meta property=\"og:description\" content=\"Hi, I&#8217;m looking for a way to insert some Javascript to scroll to the top of the event list after pagination. Is there a js pagination function that Events Calendar uses that I could use to do that? Right now when the pagination completes I have to scroll back up to the top of the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/\" \/>\n<meta property=\"article:modified_time\" content=\"2017-02-21T21:26:44+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/\",\"name\":\"Firing JS after pagination to scroll to top of element -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-02-20T22:48:48+00:00\",\"dateModified\":\"2017-02-21T21:26:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Firing JS after pagination to scroll to top of element\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Firing JS after pagination to scroll to top of element -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/","og_locale":"en_US","og_type":"article","og_title":"Firing JS after pagination to scroll to top of element -","og_description":"Hi, I&#8217;m looking for a way to insert some Javascript to scroll to the top of the event list after pagination. Is there a js pagination function that Events Calendar uses that I could use to do that? Right now when the pagination completes I have to scroll back up to the top of the [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/","article_modified_time":"2017-02-21T21:26:44+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/","name":"Firing JS after pagination to scroll to top of element -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-02-20T22:48:48+00:00","dateModified":"2017-02-21T21:26:44+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/firing-js-after-pagination-to-scroll-to-top-of-element\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Firing JS after pagination to scroll to top of element"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1242466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1242466\/revisions"}],"predecessor-version":[{"id":1243296,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1242466\/revisions\/1243296"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1242466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}