{"id":86,"date":"2012-10-06T14:30:59","date_gmt":"2012-10-06T18:30:59","guid":{"rendered":"https:\/\/havalite.com\/?p=86"},"modified":"2023-01-24T13:08:51","modified_gmt":"2023-01-24T18:08:51","slug":"jsound-jquery-plugin","status":"publish","type":"post","link":"https:\/\/havalite.com\/?p=86","title":{"rendered":"jSound &#8211; jQuery plugin"},"content":{"rendered":"<p><strong>JSound 1.0.1 <\/strong>is jQuery plugin for playing sounds on any HTML tag element<\/p>\n<p><strong>JSound <\/strong>works only on modern browser with html5. We always need 2 files as <strong>*.mp3<\/strong> and <strong>*.ogg<\/strong><\/p>\n<p>We implement the jQuery framework and jsound plugin in the head part of our site as follow:<\/p>\n<pre class=\"js\">&lt;script language=\"javascript\" src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.6.2\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n  &lt;script language=\"javascript\" src=\"jsound.js\"&gt;&lt;\/script&gt;\r\n<\/pre>\n<p>First we open jsound.js and declare which tag elements should be used to play audio:<\/p>\n<pre class=\"js\">\/\/ here I'll use &lt;a&gt;, &lt;p&gt; and &lt;input&gt; tags\r\n  var soundElem = 'a, p, input';\r\n<\/pre>\n<p>Now we can use the jsound attributes in the defined tags:<\/p>\n<pre class=\"js\">&lt;p startSound=\"country_day\"&gt;&lt;\/p&gt;\r\n  &lt;a href=\"#\" hoverSound=\"beep\"&gt;let the mouse path over me&lt;\/a&gt;\r\n<\/pre>\n<pre class=\"js\">&lt;input type=\"text\" name=\"inputfield\" focusInSound=\"space\" focusOutSound=\"journey\" \/&gt;\r\n  \r\n  \r\n\/\/ to stop all running sounds use the function stopSounds()\r\n&lt;a href=\"#\" onClick=\"stopSounds();\"&gt;Stop all sounds&lt;\/a&gt;\r\n  \r\n<\/pre>\n<p>Here are all attributes<\/p>\n<ol class=\"theElem\">\n<li><span style=\"color: #3399ff;\">startSound <\/span><span class=\"comment\">\/\/ starts sound when page is complete loaded<\/span><\/li>\n<li><span style=\"color: #3399ff;\">loopSound <\/span><span class=\"comment\">\/\/ additional to startSound<\/span><\/li>\n<li><span style=\"color: #3399ff;\">hoverSound<\/span><\/li>\n<li><span style=\"color: #3399ff;\">leaveSound<\/span><\/li>\n<li><span style=\"color: #3399ff;\">clickSound<\/span><\/li>\n<li><span style=\"color: #3399ff;\">moveSound<\/span><\/li>\n<li><span style=\"color: #3399ff;\">focusInSound<\/span><\/li>\n<li><span style=\"color: #3399ff;\">focusOutSound<\/span><\/li>\n<\/ol>\n<p>If you like to use the sound effect to a specified tag without typing the attributes every time, than you can change the allElems variable to TRUE in jsound.js<\/p>\n<blockquote>\n<pre class=\"js\">var soundElem = 'a';\r\nvar allElems = true;\r\nvar aHover = 'myHoverSound';\r\nvar aLeave = 'myLeaveSound';\r\nvar aClick = 'myClickSound';<\/pre>\n<\/blockquote>\n<p><span class=\"download\"><a href=\"https:\/\/havalite.com\/download\/jsound\/\"><big>See Demo<\/big><\/a><\/span>\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 <span class=\"download\"><big>Download: <a href=\"https:\/\/havalite.com\/download\/jsound\/jsound.js\">jsound.js<\/a><\/big><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>JSound 1.0.1 is jQuery plugin for playing sounds on any HTML tag element JSound works only on modern browser with html5. We always need 2 files as *.mp3 and *.ogg We implement the jQuery framework and jsound plugin in the head part of our site as follow: &lt;script language=&#8221;javascript&#8221; src=&#8221;https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.6.2\/jquery.min.js&#8221;&gt;&lt;\/script&gt; &lt;script language=&#8221;javascript&#8221; src=&#8221;jsound.js&#8221;&gt;&lt;\/script&gt; First we [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[28,37,41,9,42,43,10,31,17,35,39,38,29,45,30,44,40,36],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-jquery-plugins","tag-audio","tag-buttons-effect","tag-click","tag-download","tag-focusin","tag-focusout","tag-free","tag-hover","tag-html5","tag-jquery-plugins","tag-leave","tag-move","tag-mp3","tag-music","tag-ogg","tag-onblur","tag-onclick","tag-sound"],"_links":{"self":[{"href":"https:\/\/havalite.com\/index.php?rest_route=\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/havalite.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/havalite.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/havalite.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/havalite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=86"}],"version-history":[{"count":14,"href":"https:\/\/havalite.com\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/havalite.com\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions\/545"}],"wp:attachment":[{"href":"https:\/\/havalite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/havalite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/havalite.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}