0

I am currently converting my HTML into a WordPress Site. The site uses the 'inview' jQuery plugin.

I can't seem to be able to get it working within WordPress.

I have inserted the plugin link inside of the header.php: src="js/jquery.inview.js"

and the following in the footer.php:

<script type="text/jscript">
$('#seoHomeImage, #socialBar').bind('inview', function(event, visible) {
if (visible) {
$(this).stop().animate({ opacity: 1 });
} else {
$(this).stop().animate({ opacity: 0 });
}
});
</script>

I also have this from Chris Coyiers Blank theme, in the functions:

if ( !is_admin() ) {
   wp_deregister_script('jquery');
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"), false);
   wp_enqueue_script('jquery');
}

Do I have to somehow link the 'inview' plugin inside the functions page?

Thanks for looking :-)

2
  • Is there any console output. Maybe the order of script loading is messed up. Commented Aug 27, 2013 at 11:18
  • I cannot mark this one as duplicate because the other one in not accepted and doesn't have any upvotes. But the Answer is exactly the same as I would provide here. In short: don't de-register WP bundled jQuery & use the correct hook to enqueue & add jQuery as a dependency of your own script. Commented Aug 27, 2013 at 11:33

1 Answer 1

0

You should put this code into document.ready section when DOM is finished event

    $(function () {
        $('#seoHomeImage, #socialBar').bind('inview', function(event, visible) {
            if (visible) {
                $(this).stop().animate({ opacity: 1 });
            } else {
                $(this).stop().animate({ opacity: 0 });
            }
        });
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.