Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Convert jQuery snippit to work in noConflict mode

  • 20-06-2011 06:11PM
    #1
    Registered Users, Registered Users 2 Posts: 6,652 ✭✭✭


    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, Registered Users 2 Posts: 6,652 ✭✭✭daymobrew


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


Advertisement