WordPress.org

Forums

jScrollPane doesn't work with WordPress' jQuery but works with my own copy (5 posts)

  1. cpkid2
    Member
    Posted 5 years ago #

    For some reason, jScrollPane which creates custom scrollbars does not work when I use WordPress' copy of jQuery but works when I use my own local copy.

    Ex: Works

    <?php wp_head(); ?>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery.mousewheel.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery.em.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jScrollPane.js"></script>
    <script type="text/javascript">
    $(function()
    {
    $('.scroll-pane').jScrollPane();
    $('.scroll-pane').jScrollPane({showArrows:true});
    
    });
    </script>

    Ex: Doesn't work

    <?php wp_enqueue_script('jquery'); ?>
    <?php wp_head(); ?>
    
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery.mousewheel.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jquery.em.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/jScrollPane.js"></script>
    <script type="text/javascript">
    $(function()
    {
    $('.scroll-pane').jScrollPane();
    $('.scroll-pane').jScrollPane({showArrows:true});
    
    });
    </script>

    Can anyone help me diagnose this problem?

  2. aradams
    Member
    Posted 5 years ago #

    That is happening to me too.
    [edit] see next post.

  3. aradams
    Member
    Posted 5 years ago #

    Seems that jQuery runs in "no conflict" mode now and you can't use $ in your scripts, it has to be jQuery. See the Codex for a workaround: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress

  4. ciphasublime
    Member
    Posted 5 years ago #

    Hello. Im having issues with scroll panel working in my wordpress. Im not sure if it has to do with conflicting jquery libraries or if it's causing issues because its contained inside an jquery tab div.

    Here is my code that is in my header file.

    <?php wp_head(); ?>
    <!-- CSS SECTION  ||||||||||||||||||||||||||||||||| -->
    <link href="<?php bloginfo('template_directory')?>/style.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="<?php bloginfo('template_directory')?>/css/scrollstyles.css" rel="stylesheet" type="text/css" />
    <link href="<?php bloginfo('template_directory')?>/css/scroll.css" rel="stylesheet" type="text/css" />
    <link href="<?php bloginfo('template_directory')?>/css/featured.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="<?php bloginfo('template_directory')?>/css/bubbles.css" type="text/css" media="screen" charset="utf-8" />
    
    <!--round corners-->
    	<script type="text/JavaScript" src="<?php bloginfo('template_directory')?>/js/round/rounded_corners.inc.js"></script>
    <!--scrollbar-->
    <script type='text/javascript' src="<?php bloginfo('template_directory')?>/js/flexscroll/jscrollpane.js"></script>
    
    <!--Sliding nav	-->
    <script type="text/javascript" src="<?php bloginfo('template_directory')?>/js/navslide/jquery.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory')?>/js/navslide/sliding_effect.js"></script>
    
    <!--glam slider-->
    
    <!--Sliderpart-->
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script>
    
            <script type="text/javascript">
    		$(function()
    			{
    $('#mycustomscroll').jScrollPane();
    			});
    	jQuery(document).ready(function(){
    		jQuery("#hero-slider > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0, false);
    	});
    
    jQuery(document).ready(function(){
    	jQuery(".boxhead").hover(function(){
    			jQuery(this).next().slideToggle(400);
    			},
    			function(){
    				jQuery(this).next().slideToggle(400);
    			});
    	});
    	window.onload = function() {
    	      settings = {
    	          tl: { radius: 10 },
    	          tr: { radius: 10 },
    	          bl: { radius: 10 },
    	          br: { radius: 10 },
    	          antiAlias: true,
    	          autoPad: true
    	      }
    	      var myBoxObject = new curvyCorners(settings, "rounded");
    	      myBoxObject.applyCornersToAll();
    	  }
    	  });
    
            </script>

    below is my html content info

    <div id="Home"class="section">
                 <h2 class="title"></h2>
    
    		<div id="mycustomscroll" class="flexcroll">
    			<p> <a href="http://www.hesido.com/">Lorem ipsum</a> dolor sit amet, consectetuer adipiscing elit. Pellentesque ultrices facilisis risus. Aenean sollicitudin imperdiet justo. Nam sed nulla sed metus blandit pretium. Morbi odio. Maecenas vestibulum dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam in elit. Nam venenatis urna id diam. Quisque porta. Sed ultricies, sem vel gravida mollis, pede lectus vehicula orci, quis sodales mauris velit vitae dui. Sed tincidunt mauris ut libero. Suspendisse potenti. Praesent adipiscing. Sed sem. Ut non justo. Cras pretium nibh scelerisque nibh hendrerit venenatis. </p>
    			<p> Nullam lobortis, dui nec accumsan molestie, ligula libero porta urna, in tincidunt ante lacus ac diam. Vestibulum erat risus, scelerisque non, mattis sit amet, aliquet convallis, enim. Sed mattis. Phasellus tristique. Nullam metus ipsum, sagittis at, tempor non, consectetuer eget, massa. Curabitur metus lacus, fringilla ac, interdum condimentum, hendrerit non, est. Morbi iaculis. Aenean lacus lectus, lacinia eget, hendrerit id, imperdiet ac, nisl. Praesent metus. Morbi mi elit, lacinia fringilla, luctus ut, tempor at, diam. Nulla arcu nibh, condimentum fringilla, nonummy et, volutpat eget, orci. Suspendisse et dui. Integer eget lorem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Suspendisse vitae odio. Sed risus nisl, mattis vitae, imperdiet et, semper nec, tellus. Quisque adipiscing, neque id faucibus fringilla, eros augue ultricies orci, quis tincidunt tortor elit gravida ligula. Suspendisse suscipit sem sit amet ipsum. Etiam elit. </p>
    			<p> Aenean ullamcorper leo a neque. Ut eros risus, ornare sed, luctus sit amet, mollis ut, nisl. Proin dui. Aliquam suscipit. Vestibulum nisl wisi, eleifend at, placerat et, lobortis vitae, dui. Nulla dapibus pretium nulla. In hac habitasse platea dictumst. Cras ultricies nisl eu est. Aliquam ultrices, orci in dapibus facilisis, tortor pede bibendum neque, eget vestibulum lectus wisi vitae orci. Phasellus quis metus. In turpis diam, varius in, pulvinar sit amet, commodo ut, wisi. Donec leo nibh, iaculis in, facilisis non, mollis eget, eros. Morbi sem. </p>
    			<p> Nunc sed arcu. Phasellus euismod tincidunt eros. Proin ac purus. In dictum ante vitae libero. Proin pede. Pellentesque tellus ipsum, semper quis, dapibus eget, ultricies ac, pede. Aenean tristique tincidunt lorem. Aenean eget eros quis tellus tincidunt condimentum. Aliquam tempor, erat sit amet condimentum sagittis, ante sapien dapibus lectus, in tempor mauris sem non metus. Nam id orci. Nulla dignissim, felis in euismod tempor, neque turpis suscipit urna, id tristique mauris eros et dui. </p>
    			<p> Aliquam eget felis id elit congue tempus. Maecenas a velit. Sed egestas malesuada sapien. In sapien. Integer sit amet massa vitae justo vulputate viverra. Fusce suscipit, mi a lacinia lobortis, urna enim consectetuer risus, et ultrices ante nulla nec mauris. Integer pulvinar aliquet turpis. Phasellus fermentum diam at mauris. Ut nulla est, rhoncus sed, malesuada eget, rutrum ac, nunc. Curabitur in ante. </p>
    
    		 <p>Bottom</p>
    		</div>
                </div>

    Help would be greatly appreciated. I have tried numerous times to get this right.

    Thanks in advanced

  5. SomeFunkyDude
    Member
    Posted 4 years ago #

    Well, I spent most the evening creating my own "custom scrollbar", but grew envious of jScrollPane because it can do a few things that I couldn't figure out, so like usually, I revisit the original solution, and viola, works like a charm.

    Try this... (don't forget to enqueue jquery, jscrollpane.js, and the jscrollpane css code)

    $j=jQuery.noConflict();
    $j("#scroll-pane").jScrollPane();

    This is all you need, I thought I might have to sift through and update jScrollPane.js to reflect this noConflict() method, but you do not, only when you want to finally apply it to the scrolling element.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.