• I am using a jQuery plugin on a website called jQuery Backstretch that places a resizable background image on the site. I developed the site locally with MAMP in Thematic and it worked perfectly. Now that I’ve uploaded it, the site works fine but the background image won’t appear. Any ideas? Here’s the site…

    marconiband.com

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’re backstretch script links are wrong and duplicated, and the document ready function for backstretch is wrong. And and you’re loading jquery twice.

    loaded twice:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>

    bad and duplucate links:

    <script type="text/javascript" src="/jquery.backstretch.min.js"></script>
    <script src="https://marconiband.com/wp-content/themes/marconi/js/jquery.backstretch.min.js"></script>

    bad doc ready call:

    <script>
    jQuery(document).ready(function(){
    jQuery.backstretch("https://marconiband.com/wp-content/themes/marconi/images/background1.jpg", {speed: 300});
    });
    </script>

    Thread Starter initialsbr

    (@initialsbr)

    Thanks songdogtech. But I was emailing with a guy from my hosting service and somehow the permission settings were off for the image. I don’t know how that happened. He fixed the setting and now everything is working correctly. But I would like to correct the things you mention. This is the first time I’ve used jQuery and I struggled with trying to get help in the Thematic forums until this code worked. In the functions.php file, this is what I have…

    //Background
    function background() { ?>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
    <script type="text/javascript" src="/jquery.backstretch.min.js"></script>
    <script src="https://marconiband.com/wp-content/themes/marconi/js/jquery.backstretch.min.js"></script>
    <script>
    jQuery(document).ready(function(){
    jQuery.backstretch("https://marconiband.com/wp-content/themes/marconi/images/background1.jpg", {speed: 300});
    });
    </script>
    <?php }
    add_action('thematic_before', 'background');

    How would you modify it?

    Look at the function; you’re linking backstretch twice, once from root and once from the theme directory. And then you’re loading jquery from google in the function, but also – look at your page source – it’s alreading loaded from WordPress.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘JQuery works locally on 3.0 but not online’ is closed to new replies.