javascript - Jquery show/hide button not working on homepage -


i made little button show hide code homepage. if put code in internal pages works fine if put on homepage doesn't work. if put jquery cdn in header revolution slider stops working.

here's homepage section can see code:

http://www.mythstreet.com/#our-services 

here's fiddle fine working:

http://jsfiddle.net/junaidkhawaja/ha6qp7w4/6/ 

here's snippet of code: html

    <div id="1">     content 1 </div>  <div id="2" style="display:none;">     dynamic content </div>  <div id="static" style="display:none;">     static content </div> <button id="btnclick">click me!</button> <hr /> <div id="3">     content 1 </div>  <div id="4" style="display:none">     dynamic content </div>  <div id="static2" style="display:none;">     static content </div> <button id="btnclick2">click me!</button> 

javascript:

$( document ).ready(function() {    $('#btnclick').on('click',function(){     if($('#1').css('display')!='none'){     $('#2').html($('#static').html()).show().siblings('#1').hide();     }else if($('#2').css('display')!='none'){         $('#1').show().siblings('#2').hide();     } });     $('#btnclick2').on('click',function(){     if($('#3').css('display')!='none'){     $('#4').html($('#static2').html()).show().siblings('#3').hide();     }else if($('#4').css('display')!='none'){         $('#3').show().siblings('#4').hide();     } });     }); 

update: found after putting code, sliders not working well.

just looking @ site , playing around in console, can see $ isn't defined.

a quick fix changing code use jquery() instead of $(...)

note: can't debug further you've fixed code on live site (hooray!)


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jquery - Keeping Kendo Datepicker in min/max range -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -