最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

WordPress Jquery with heade and footer sritp plugin

programmeradmin5浏览0评论

I have been trying to solve this for literlally weeks.

I have inserted jQuery into the header section with header and footer script plugin. The problem is that WordPress ignores all of this code. As if it is not there. Indeed the website appears the same with or without code! Why would this be?

DO I need to add some code the functions.php. I have tried many variations of this with no effect. Do I need to do something else? If yes what?!

I am running the theme of 2011. Is this the problem? I do not see why it would be.

Simply I am asking how I can get my website to run jQuery.

All help very much appreciated

JQuery code below if it makes a difference, as you can see I am simply trying to do a rollover for a couple of images. Before I try some other features once I get WordPress to notice my code.

<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
$('#gallery img').each(function() {
var imgFile = $(this).attr('..../blog/wp-content/uploads/_images/unknown.jpg');``
var preloadImage = new Image();
var imgExt = /(\.\w{3,4}$)/;
preloadImage.src = imgFile.replace(imgExt, '_h$1');
 $(this).hover (
    function() {
      $(this).attr('src', preloadImage.src);
 },
   function() {
     $(this).attr('src', imgFile);
    }
 ); // end hover
}); // end each
}); // end ready
</script>
发布评论

评论列表(0)

  1. 暂无评论