{"id":4837750,"date":"2014-04-22T21:51:09","date_gmt":"2014-04-22T21:51:09","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/helpful-code-snippets\/"},"modified":"2016-08-21T19:37:17","modified_gmt":"2016-08-21T19:37:17","slug":"helpful-code-snippets","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/helpful-code-snippets\/","title":{"rendered":"Helpful code snippets"},"content":{"rendered":"<p>As Easing Slider contains many JS and PHP functions that users can hook into when creating their own additional functionality, I&#8217;ve decided to make a topic where users can share their code snippets.<\/p>\n<p>Here are two I find users asking for quite often. Add these to your theme&#8217;s header.php file before the &lt;\/head&gt;. You can also add these to your own Javascript files, or even into your footer.php file before the &lt;\/body&gt;.<\/p>\n<p><strong>Pause slideshow on hover<\/strong><\/p>\n<pre><code>&lt;script type=&quot;text\/javascript&quot;&gt;\njQuery(document).ready(function($) {\n    $(&#039;.easingsliderlite&#039;).on(&#039;mouseenter&#039;, function() {\n        $(&#039;.easingsliderlite&#039;).data(&#039;easingsliderlite&#039;).pausePlayback();\n    });\n    $(&#039;.easingsliderlite&#039;).on(&#039;mouseleave&#039;, function() {\n        $(&#039;.easingsliderlite&#039;).data(&#039;easingsliderlite&#039;).resumePlayback();\n    });\n});\n&lt;\/script&gt;<\/code><\/pre>\n<p><strong>End automatic playback after all slides have been shown<\/strong><\/p>\n<pre><code>&lt;script type=&quot;text\/javascript&quot;&gt;\n    jQuery(document).ready(function($) {\n        var inc = 0;\n        $(&#039;.easingsliderlite&#039;).data(&#039;easingsliderlite&#039;).$el.on(&#039;nextslide&#039;, function() {\n            inc++;\n            if (inc == $(&#039;.easingsliderlite&#039;).data(&#039;easingsliderlite&#039;).count) {\n                 $(&#039;.easingsliderlite&#039;).data(&#039;easingsliderlite&#039;).endPlayback();\n            }\n        });\n    });\n&lt;\/script&gt;<\/code><\/pre>\n<p>Feel free to share your own \ud83d\ude42<\/p>\n<p>https:\/\/wordpress.org\/plugins\/easing-slider\/<\/p>\n","protected":false},"template":"","class_list":["post-4837750","topic","type-topic","status-closed","hentry","topic-tag-code","topic-tag-pause-on-hover"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4837750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4837750\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4837750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}