{"id":2091,"date":"2020-08-07T18:46:50","date_gmt":"2020-08-07T16:46:50","guid":{"rendered":"https:\/\/store.bajorat-media.com\/?post_type=lesson&#038;p=2091"},"modified":"2020-08-08T00:57:34","modified_gmt":"2020-08-07T22:57:34","slug":"local-scroll-with-own-jquery-script","status":"publish","type":"lesson","link":"https:\/\/store.bajorat-media.com\/en\/lesson\/local-scroll-mit-eigenem-jquery-script\/","title":{"rendered":"Local Scroll with custom jQuery script"},"content":{"rendered":"<p>A beautifully animated local scroll or anchor jump is typical for the modern web. In this video I show you how to develop a corresponding script based on jQuery.<\/p>\n<p>Here you can find the complete code for the local scroll with jQuery. Don't forget to use the full jQuery version for the animation and not only the slim version.<\/p>\n<pre class=\"prettyprint linenums\">$( document ).ready(function() {\r\n    \r\n    $('.local-scroll').on('click', function(e){\r\n        e.preventDefault();\r\n\r\n        var href = $(this).attr('href');\r\n\r\n        var offsetTop = $( href ).offset().top;\r\n\r\n        if( href == '#unser-program' ) {\r\n            offsetTop = offsetTop - 150;\r\n        }\r\n\r\n        $('html, body').animate({\r\n            scrollTop: offsetTop\r\n        }, 'slow');\r\n    });\r\n});<\/pre>","protected":false},"excerpt":{"rendered":"","protected":false},"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_initial_content":"","_new_post":false,"_quiz_has_questions":false,"_lesson_complexity":"std","_lesson_length":16,"_lesson_course":1892,"_lesson_preview":"preview"},"lesson-tag":[],"class_list":["post-2091","lesson","type-lesson","status-publish","hentry","module-bootstrap-und-jquery","post"],"acf":[],"is_coteacher":false,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/lessons\/2091","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/lessons"}],"about":[{"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/types\/lesson"}],"replies":[{"embeddable":true,"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/comments?post=2091"}],"version-history":[{"count":2,"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/lessons\/2091\/revisions"}],"predecessor-version":[{"id":2100,"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/lessons\/2091\/revisions\/2100"}],"wp:attachment":[{"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/media?parent=2091"}],"wp:term":[{"taxonomy":"lesson-tag","embeddable":true,"href":"https:\/\/store.bajorat-media.com\/en\/wp-json\/wp\/v2\/lesson-tag?post=2091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}