I am trying to make a wordpress plugin that will run a jQuery script when I activate plugin and my jquery code is below:
jQuery(document).ready(function($){
jQuery(window).scroll(function() {
if(jQuery(this).scrollTop() != 0) {
jQuery("#toTop").fadeIn("slow");
} else {
jQuery("#toTop").fadeOut("slow");
}
});
jQuery("#toTop").click(function() {
jQuery("body,html").animate({scrollTop:0},1000);
});
});
Please tell me wordpress plugin code which will run this query on every wordpress site page when I activate plugin.
to insert js into the footer of every page, try;