Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Convert jQuery snippit to work in noConflict mode

Options
  • 20-06-2011 6:11pm
    #1
    Registered Users Posts: 6,501 ✭✭✭


    I am trying to incorporate jScroller ticker into a WordPress site but having problems with the noConflict code.

    The docs give the following example code:
    <script type="text/javascript">
     $(document).ready(function(){
    
      // Add Scroller Object
      $jScroller.add("#scroller_container","#scroller","left",1);
    
      // Start Autoscroller
      $jScroller.start();
     });
    </script>
    
    As jQuery in WordPress runs in "no conflict" mode, I tried converting this to:
    jQuery(document).ready(function($) {
      // Add Scroller Object
      $jScroller.add("#news-ticker","#tickercontainer","left",1);
    
      // Start Autoscroller
      $jScroller.start();
     });
    
    The error console in Firefox says "$ is not a function" for the code in the jScroller file (it is packed so I cannot figure exactly what code is causing the problem).

    Can I fix this with my code or would the jScroller code have to be changed?

    Aside, I was using liScroll but it seems to be CPU intensive.


Comments

  • Registered Users Posts: 6,501 ✭✭✭daymobrew


    I got somewhere with this: in the jscroller-0.4.js file I changed all $() references to jQuery().


Advertisement