Support » Plugins » Hacks » jQuery conflicts help

  • Hi guys,

    this is my first post in these forums so forgive me if this has already been answered but I have had a look around and just can’t solve my issue.

    The site i’m working on is… here
    It’s a one page site that uses jquery smooth scrolling to navigate. It all worked fine until I used the tour-dates plugin that you can see in the ‘gigs’ section, for some reason that throws off the scrolling action by the height of the tour-dates container div (I think).

    I don’t think it’s a problem with my smooth scrolling code which is here…

    <script type="text/javascript">
    $(document).ready(function() {
      function filterPath(string) {
      return string
      var locationPath = filterPath(location.pathname);
      var scrollElem = scrollableElement('#main');
      $('a[href*=#]').each(function() {
        var thisPath = filterPath(this.pathname) || locationPath;
        if (  locationPath == thisPath
        && (location.hostname == this.hostname || !this.hostname)
        && this.hash.replace(/#/,'') ) {
          var $target = $(this.hash), target = this.hash;
          if (target) {
            var targetOffset = $target.offset().top - 130;
            $(this).click(function(event) {
              $(scrollElem).animate({scrollTop: targetOffset}, 1000, function() {
                location.hash = target;
      // use the first element that is "scrollable"
      function scrollableElement(els) {
        for (var i = 0, argLength = arguments.length; i <argLength; i++) {
          var el = arguments[i],
              $scrollElement = $(el);
          if ($scrollElement.scrollTop()> 0) {
            return el;
          } else {
            var isScrollable = $scrollElement.scrollTop()> 0;
            if (isScrollable) {
              return el;
        return [];

    because it was working fine before I installed the tour-dates plugin so I think it’s most likely that i’ve included jquery badly.

    I know it’s the wrong way to do it but I just cant get any other way to work so i’ve linked it into the header using this…
    <script src="//"></script>

    Could someone tell me where i’m going wrong and point me in the right direction?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    wp_enqueue_script() is the proper way to include your script file. Passing the dependency argument as array('jquery') should be all that’s needed to get jquery included with your script.

    If you still have trouble, there could be a name collision or something that is causing conflict with the plugin. Neither side is doing anything wrong, but the conflict needs to be resolved.

    $(document).ready(function() {

    can be turned into

    jQuery(document).ready(function($) {

    for conflict free

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jQuery conflicts help’ is closed to new replies.