javascript - jQuery addClass works on jsfiddle but not live -
i've gone through several of questions similar mine, , have tried implement solutions, haven't managed work.
this js code using on live site:
jquery(function($){ $(".icon_circle").click(function () { $('circle').removeclass('clicked'); $(this).addclass('clicked'); }); }); here jsfiddle: http://jsfiddle.net/akxtv/3 (it adapted jquery svg removeclass())
here live site: http://watchcampfire.com/pre
edit: looks isn't working in bootply either, may issue working alongside bootstrap coding. http://www.bootply.com/120685
i'm not seeing place initialize swiper plugin (according website):
$(function(){ var myswiper = $('.swiper-container').swiper({ //your options here: mode:'horizontal', loop: true //etc.. }); }) because don't seem have that, may cause of uncaught typeerror: cannot read property 'classlist' of undefined errors. fixing should make things work you.
update:
i think figured out root cause of problem here.
this should work:
$('.icon_circle').on('click', function() { $('.icon_circle').attr('class', function(index, classnames) { //this sort of lazy, oh return 'icon_circle'; }); $(this).attr('class', function(index, classnames) { return classnames + ' clicked'; }); }); there's sort of issue adding/removing classes on svg elements.
more detail here: jquery svg, why can't addclass?
Comments
Post a Comment