ThemeShaper Forums » Thematic

[closed]

Lazy Load in Functions.php

(5 posts)
  • Started 9 years ago by Baudesign
  • Latest reply from Baudesign
  • This topic is resolved
  1. Baudesign
    Member

    Hello,

    I am trying to implement the Lazy Load Script for single pages in Magazine-Audio.com, since this site uses a lot of pictures.

    Ref.:
    http://www.appelsiini.net/projects/lazyload
    http://www.magazine-audio.com/2010/sylvain-cossette/

    For some reason, it just does not work:

    //Lazyload
    function my_lazyload_script(){
    if(is_single()){?>
        <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/lazyload.js"></script>
        	<script type="text/javascript">
    		$(function() {
              $("img").lazyload({
                 placeholder : "grey.gif",
                 effect      : "fadeIn"
              });
          });
    		</script>
    	<?php }}
    add_action('wp_head','my_lazyload_script');

    Does anybody know what the problem might be?

    Thanks

    Pat

    Posted 9 years ago #
  2. i was working with a different jquery plugin and figured out how to make it work w/ thematic and wrote up some instructions i followed:

    http://forums.themeshaper.com/topic/how-to-add-jquery#post-12435

    Posted 9 years ago #
  3. Baudesign
    Member

    Thanks helgatheviking,

    Although I know what to do, and have done it before regarding jQuery scripts, this one does not seem to work, and I do not know why. Perhaps something to do with another script?

    If someone could check the source code, I would appreciate.

    Thanks

    Pat

    Posted 9 years ago #
  4. oh well. sorry it didn't help more. i don't know much about jquery... in fact everything i know is written in that other post. :)

    Posted 9 years ago #
  5. Baudesign
    Member

    Resolved: I used the plugin found in the plugin directory. ;-)

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.