iamjpg / Ez-Background-Resize

Resizable full-browser background image using jQuery. Implementation requires no CSS.
http://johnpatrickgiven.com/jquery/background-resize/
89 stars 32 forks source link

Conflict with Wordpress #15

Open jorgk3 opened 10 years ago

jorgk3 commented 10 years ago

In your example you have this code:

<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>

Sadly, this conflicts with the jQuery used by Wordpress. According to Wordpress documentation, it's a no-no to preload stuff, see for example: https://pippinsplugins.com/why-loading-your-own-jquery-is-irresponsible/

Instead of this:

<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>
<script src="<?php bloginfo('template_url'); ?>/js/jquery.ez-bg-resize.js" type="text/javascript" charset="utf-8"></script>
<script>
  $(document).ready(function() {

this works in a Wordpress installation:

<script src="<?php bloginfo('template_url'); ?>/js/jquery.ez-bg-resize.js" type="text/javascript" charset="utf-8"></script>
<script>
  jQuery(document).ready(function($) {

Perhaps you can update the documentation.