jQuery冲突 - 滑块问题

时间:2012-12-15 08:52:07

标签: jquery conflict parallax flexslider sliders

我是JavaScript jQuery的新手。

我在主题中使用了两个滑块,即flex滑块和parallax slider

如果我在每个页面中单独使用这些jQuery,滑块工作正常。如果我尝试使用单个文件调用它不起作用。

以下jQuery代码中是否有任何错误?

否则是否有其他方法使用if condition使用滑块的#id执行jQuery?

/*-----------------------------------------------------------------------------------
/*
/* Custom JS
/*
-----------------------------------------------------------------------------------*/

/* Start Document */
jQuery(document).ready(function() {

    /* Responsive Menu */
    domready(function(){

        selectnav('nav', {
            label: 'Menu',
            nested: true,
            indent: '-'
        });

    });


    /* Nivo slider */

      // Vimeo API nonsense
      var player = document.getElementById('player_1');
      $f(player).addEvent('ready', ready);

      function addEvent(element, eventName, callback) {
        (element.addEventListener) ? element.addEventListener(eventName, callback, false) : element.attachEvent(eventName, callback, false);
      }

      function ready(player_id) {
        var froogaloop = $f(player_id);

        froogaloop.addEvent('play', function(data) {
          $('.flexslider').flexslider("pause");
        });

        froogaloop.addEvent('pause', function(data) {
          $('.flexslider').flexslider("play");
        });
      }
      // Call fitVid before FlexSlider initializes, so the proper initial height can be retrieved.
      $(".flexslider")
        .fitVids()
        .flexslider({
            animation: "fade",              //String: Select your animation type, "fade" or "slide"
            easing: "swing",               //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
            direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
            animationLoop: true,             //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
            smoothHeight: true,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
            startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
            slideshow: true,                //Boolean: Animate slider automatically
            slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
            animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
            randomize: false,               //Boolean: Randomize slide order

            // Usability features
            pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
            pauseOnHover: true,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
            useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
            touch: true
    });

    /* parallax slider */

                $('#da-slider').cslider({
                     current     : 0,   
                    // index of current slide
                    bgincrement : 10,  
                    // increment the background position
                    // (parallax effect) when sliding
                    autoplay    : true,
                    // slideshow on / off
                    interval    : 4000 
                    // time between transitions
                });

/* End Document */
});

0 个答案:

没有答案