javascript - Load Soundcloud embedded player OnClick not working in FireFox -


website: https://www.buybeatsfast.com/beats/

clicking "play beat" image should load soundcloud player track , autoplay it. works in chrome in firefox takes soundcloud track's page. tested on windows xp , windows 8 , it's not working @ in firefox, no errors on console either have no clue problem is, i'm not author of code, found on here actually.

this html:

<div class="tempsc"><a href="https://soundcloud.com/rockitpro/imstillherehook" class="scload"><span class="playbeat"><span class="icon-play-sign playbeaticon"></span> play beat</span></a></div> 

this js:

/*soundcloud click play*/ var formatplayer    = '&iframe=true'; formatplayer   += '&color=3498db'; formatplayer   += '&buying=false'; formatplayer   += '&download=false'; formatplayer   += '&show_playcount=false'; formatplayer   += '&show_reposts=false'; formatplayer   += '&show_user=false'; formatplayer   += '&show_comments=false'; formatplayer   += '&liking=false'; formatplayer   += '&hide_related=true'; formatplayer   += '&sharing=false'; formatplayer   += '&maxheight=125'; formatplayer   += '&auto_play=true'; // play once user clicks link! formatplayer   += '&show_artwork=true'; //load iframe on click $('.scload').click(function(){ event.preventdefault(); var $link = $(this); var getjsonstring = 'https://soundcloud.com/oembed?format=js&amp;url=' + $link.attr('href') + formatplayer; //replace contents $.getjson(getjsonstring + '&amp;callback=?', function(response) { var widget = response.html; var src = $(widget).attr('src'); widget = $(widget).attr('src', src.replace('?visual=true', '?visual=false')); // update iframe src $link.replacewith(widget); }); }); 

fixed. forgot pass in event click function. works in firefox.

/*soundcloud click play*/ var formatplayer    = '&iframe=true'; formatplayer   += '&color=3498db'; formatplayer   += '&buying=false'; formatplayer   += '&download=false'; formatplayer   += '&show_playcount=false'; formatplayer   += '&show_reposts=false'; formatplayer   += '&show_user=false'; formatplayer   += '&show_comments=false'; formatplayer   += '&liking=false'; formatplayer   += '&hide_related=true'; formatplayer   += '&sharing=false'; formatplayer   += '&maxheight=125'; formatplayer   += '&auto_play=true'; // play once user clicks link! formatplayer   += '&show_artwork=true'; //load iframe on click $('.scload').click(function (e) { e.preventdefault(); var $link = $(this); var getjsonstring = 'https://soundcloud.com/oembed?format=js&amp;url=' + $link.attr('href') + formatplayer; //replace contents $.getjson(getjsonstring + '&amp;callback=?', function(response) { var widget = response.html; var src = $(widget).attr('src'); widget = $(widget).attr('src', src.replace('?visual=true', '?visual=false')); // update iframe src $link.replacewith(widget); }); }); 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -