将css样式应用于bx-slider元素

时间:2012-02-09 00:47:22

标签: jquery bxslider

我已经申请了我的网站jquery效果bx-slider Bx-Slider Page但现在我将申请prev和下一个箭头我的CSS。我申请了它的图像,但我甚至应用css适当。 这是一段jquery.bxslide.js代码:

var defaults = {
        mode: 'horizontal',                                 // 'horizontal', 'vertical', 'fade'
        infiniteLoop: true,                                 // true, false - display first slide after last
        hideControlOnEnd: false,                        // true, false - if true, will hide 'next' control on last slide and 'prev' control on first
        controls: true,                                         // true, false - previous and next controls
        speed: 700,                                                 // integer - in ms, duration of time slide transitions will occupy
        easing: 'swing',                    // used with jquery.easing.1.3.js - see http://gsgd.co.uk/sandbox/jquery/easing/ for available options
        pager: false,                                               // true / false - display a pager
        pagerSelector: null,                                // jQuery selector - element to contain the pager. ex: '#pager'
        pagerType: 'full',                                  // 'full', 'short' - if 'full' pager displays 1,2,3... if 'short' pager displays 1 / 4
        pagerLocation: 'bottom',                        // 'bottom', 'top' - location of pager
        pagerShortSeparator: '/',                       // string - ex: 'of' pager would display 1 of 4
        pagerActiveClass: 'pager-active',       // string - classname attached to the active pager link
        nextText: '',                                       // string - text displayed for 'next' control
        nextImage: 'images/right_arrow.png',                                            // string - filepath of image used for 'next' control. ex: 'images/next.jpg'
        nextSelector: null,                                 // jQuery selector - element to contain the next control. ex: '#next'
        prevText: '',                                       // string - text displayed for 'previous' control
        prevImage: 'images/left_arrow.png',                                         // string - filepath of image used for 'previous' control. ex: 'images/prev.jpg'
        prevSelector: null,                                 // jQuery selector - element to contain the previous control. ex: '#next'
        captions: false,                                        // true, false - display image captions (reads the image 'title' tag)
        captionsSelector: null,                         // jQuery selector - element to contain the captions. ex: '#captions'
        auto: false,                                                // true, false - make slideshow change automatically
        autoDirection: 'next',                          // 'next', 'prev' - direction in which auto show will traverse
        autoControls: false,                                // true, false - show 'start' and 'stop' controls for auto show
        autoControlsSelector: null,                 // jQuery selector - element to contain the auto controls. ex: '#auto-controls'
        autoStart: true,                                        // true, false - if false show will wait for 'start' control to activate
        autoHover: false,                                       // true, false - if true show will pause on mouseover
        autoDelay: 0,                       // integer - in ms, the amount of time before starting the auto show
        pause: 3000,                                                // integer - in ms, the duration between each slide transition
        startText: 'start',                                 // string - text displayed for 'start' control
        startImage: '',                                         // string - filepath of image used for 'start' control. ex: 'images/start.jpg'
        stopText: 'stop',                                       // string - text displayed for 'stop' control
        stopImage: '',                                          // string - filepath of image used for 'stop' control. ex: 'images/stop.jpg'
        ticker: false,          

你可以阅读,你必须设置next / prev选择器来控制,但是当我设置一个选择器时,我的控件就消失了。为什么?

1 个答案:

答案 0 :(得分:1)

您需要在滑块所在的页面上输入您想要的jQuery元素。

因此,如果您的滑块在index.html上打开该页面并找到以下代码

<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script src="jquery.bxSlider.min.js" type="text/javascript"></script>
<script type="text/javascript">

$(function(){
  $('#slider1').bxSlider({
  });
});

并将您想要的元素放入其中。所以要为下一个添加你的箭头图像,那么你的可能就是

            <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
            <script src="jquery.bxSlider.min.js" type="text/javascript"></script>
            <script type="text/javascript">

$(function(){
  $('#slider1').bxSlider({
    nextImage: 'url of image goes here',
    prevImage: 'url of image goes here',
    prevText: '',   
    nextText: '',
  });
});

我还添加了'prevText'和nextText并将它们留空,否则图像和文本都会显示给我。

希望有助于 ThreeTwo

相关问题