Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Hide previous arrow on first slide (and next on last one) using "appendBackTo"

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #150476
    lambdaka
    Participant

    HI there ! Anythingslider is a very nice plugin.. thanks ! My little problem :

    I achieve to hide previous arrow on first slide, and next arrow on last slide using :

    infiniteSlides: false,
    stopAtEnd: true,
    

    but when I’m using “appendBackTo” to choose my own arrow

    appendBackTo: $('#nav-slider'),
    appendForwardTo: $('#nav-slider2'),
    

    the arrow I would like to hide are not hiding..

    Do I miss something..?

    The whole code below:

    <script>
        // DOM Ready
        $(function(){
            $('#slider')
                .anythingSlider({
                    appendBackTo: $('#nav-slider  span:eq(0)'),
                    appendForwardTo: $('#nav-slider  span:eq(1)'),
                    forwardText: "dhdgd<img height='20' width='20' src='//eofdreams.com/data_images/dreams/image/image-07.jpg'>",
                    backText: "<img height='20' width='20' src='//eofdreams.com/data_images/dreams/image/image-07.jpg'>dhdgd",
                    resizeContents      : true,
                    addWmodeToObject    : 'opaque',
                    buildNavigation     : false,
                    buildStartStop     : false,
                    infiniteSlides: false,
                    stopAtEnd: true
                })
                // Initialize video extension
                // see https://developers.google.com/youtube/player_parameters?hl=en#Parameters for a list of parameters
                .anythingSliderVideo({
                    // video id prefix; suffix from $.fn.anythingSliderVideo.videoIndex
                    videoId : 'asvideo',
    
                });
        });
    </script>
    

    Thanks a lot !

    #150640
    lambdaka
    Participant

    found the solution here :
    http://stackoverflow.com/questions/15155377/how-to-disable-anythingslider-forward-button-onlast-slide-and-back-button-on-fir

    Use the following code

        $('#slider').anythingSlider({
            onInitialized   : function(){
                  // hide back arrow
                  $('.arrow.back').hide();
            },
            onSlideComplete     : function(){
                if($('#slider .panel:not(.cloned)').first().hasClass('activePage')){
                  // hide back arrow
                  $('.arrow.back').hide();
                }
                else{
                  $('.arrow.back').show();
                }
    
                if($('#slider .panel:not(.cloned)').last().hasClass('activePage')){
                  // hide forward  arrow
                  $('.arrow.forward').hide();
                }
                else{
                  $('.arrow.forward').show();
                }
            }
        });
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.