views:

65

answers:

1

Can anyone give me a hand? This is for a charity event and coding clearly isn't my day job. The site is www.gingertown.org/wp

I don't understand where to put this line:

$(function() {
$('.scroll-pane').jScrollPane();
});

I also have a feeling I'm not calling the js correctly. From digging into wordpress

I modified my file to look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11"&gt;
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php wp_title('&#124;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" />
</code></pre>

    <?php wp_enqueue_script("jquery"); ?>
    <?php wp_enqueue_script( 'sfhover', get_template_directory_uri() . '/js/sfhover.js' ); ?>
    <?php wp_head(); ?>

    <!-- the mousewheel plugin - optional to provide mousewheel support -->
    <script type="text/javascript" 
 src="script/jquery.mousewheel.js"></script>

    <!-- the jScrollPane script -->
    <script type="text/javascript" 
 src="script/jquery.jscrollpane.min.js"></script>



    </head>
+1  A: 

You should put it after the jscrollpane plugin is included, here:

<script type="text/javascript" src="script/jquery.jscrollpane.min.js"></script>
<script type="text/javascript">
  jQuery(function($) {         //since your site is calling jQuery.noConflict()
    $('.scroll-pane').jScrollPane();
  });
</script>
</head>
Nick Craver
Thanks. I had it there before, but it doesn't seem to do anything. The specific page that it should show on is http://gingertown.org/wp/?cat=142
Jason
@Jason - Change `$(function() {` to `jQuery(function($) {` to fix the current error, can you update the live site with that?
Nick Craver
I changed the live site. It still doesn't pick up anything other than the default scrollbar.
Jason
@Jason - I'm getting a 404 for your script: http://gingertown.org/wp/script/jquery.jscrollpane.min.js So you're getting an error when trying to call `.jScrollPane()`.
Nick Craver
In firebug console it says:
Jason
$(".scroll-pane").jScrollPane is not a function[Break on this error] $('.scroll-pane').jScrollPane({showArrows: true});
Jason
If it is unable to call, the problem would still be in the header. Correct?
Jason
@Jason - Yes...that's because the plugin isn't included the URL I linked in the previous comment isn't valid, none of your `/script` files are actually there, you need to update those links to point to wherever your JavaScript actually is.
Nick Craver
I'm sorry, I think you lost me. I have them in /script/*.js How is the link not pointing to them?
Jason
@Jason - The files aren't at that location, `script/` means `http://gingertown.org/wp/script/` and the files aren't in there :)
Nick Craver
OH! >>insert lightbulb on!<< My head was still in CSS links. That makes sense. I updated the location to point to the scripts folder in my theme. It's still giving the same console error about it not being a function.
Jason
@Jason - Still getting a 404: http://gingertown.org/public_html/wp/wp-content/themes/gingertown001/script/jquery.jscrollpane.min.js In Firefox view source, and you can click on he `.js` to get the same errors...so the script still aren't quite in the right place.
Nick Craver
Okay. Hardcoded the links and they seem to be working now. Thanks for the patience with this! JS content is being generated on the page so I think I just have to sift through the css and/or div tags to make the scrollbar appear.
Jason