/* * we load the html code for the mp3 file from js in the *ready function so it will not start playing before loading the full page * we got 2 cookies one defined for one session and another defined for ever if the * #popup id is clicked */ (function ($) { $(document).ready(function () { if ($.cookie('bubble_session-new') != undefined) { if ($.cookie('bubble_session-new') == 'hide') { bubble_session(); } } if ($.cookie('bubble-new') != undefined) { if ($.cookie('bubble-new') == 'hide') { bubble(); } } $("#popUp").click(function () { bubble(); }); function bubble() { var vid = document.getElementById("intro-voice"); $(".oval-thought").css('display', 'none'); $(".smallCircle").css('display', 'none'); $(".bigCircle").css('display', 'none'); $("#voiceDiv").hide(); $("#voiceDiv-EN").hide(); $.cookie('bubble-new', 'hide', { expires: 9999, path: '/' }); vid.autoplay = false; vid.load(); } function bubble_session() { var vid = document.getElementById("intro-voice"); $(".oval-thought").css('display', 'none'); $(".smallCircle").css('display', 'none'); $(".bigCircle").css('display', 'none'); $("#voiceDiv").hide(); $("#voiceDiv-EN").hide(); $.cookie('bubble_session-new', 'hide', { path: '/' }); if (vid != null) { vid.autoplay = false; vid.load(); } } if ($.cookie('bubble_session-new') != 'hide' && $.cookie('bubble-new') != 'hide') { $(".oval-thought").delay(1000).fadeIn(); $(".smallCircle").delay(0).fadeIn(); $(".bigCircle").delay(500).fadeIn(); $(".oval-thought").delay(36000).fadeOut(); $(".smallCircle").delay(35500).fadeOut(); $(".bigCircle").delay(35000).fadeOut(); $("#voiceDiv").delay(36000).fadeOut(); $("#voiceDiv-EN").delay(12000).fadeOut(); $.cookie('bubble_session-new', 'hide', { path: '/' }); } }); })(jQuery);