Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes carousel sliding issues #6379

Closed
wants to merge 1 commit into from
Closed

fixes carousel sliding issues #6379

wants to merge 1 commit into from

Conversation

Yohn
Copy link
Contributor

@Yohn Yohn commented Dec 23, 2012

Theres 2 slide fixes in the pull request..

First is when we click on the new indicators and stay hovered on the carousel it still cycles through the rest of the items, not pausing it as it should. to fix this, I added the , mouseover in the beginning of the plugin

The second refers to #5747 when the pausing feature stops working when you hover on the carousel while its in the middle of sliding. In that issue. @andreif pointed out that if we remove the this.cycle() from the pause function it works as expected..

I'm not sure how I would go about creating the tests for this, which is why I didnt include it.. is there a way to trigger the hover effect? I did update the carousel plugin on my local machine and ran the tests and it passed

added `, mouseover` to prevent the slide from happening if the mouse clicked on the indicator icons
removed `this.cycle()` from the pause function to prevent the carousel from sliding when we hover over the carousel in the middle of a slide
@fat
Copy link
Member

fat commented Dec 24, 2012

that mouseover fix doesn't make sense to me :/

can u add a unit test which reproduces this

@Yohn
Copy link
Contributor Author

Yohn commented Dec 24, 2012

what was happening was when we clicked on the indicators and didnt mouseout of the carousel it wouldnt pause it, and mouseover stopped it from cycling through the slides

Ive been trying to come up with a way to do this with the tests but couldnt come up with the correct way yet.. heres what I was playing with..

      test("should not slide carsousel on mouseover", function () {
        var temp = $('<div id="myCarousel" class="carousel slide" data-interval="1000"> <ol class="carousel-indicators"><li data-target="#myCarousel" data-slide-to="0" class="active"></li><li data-target="#myCarousel" data-slide-to="1"></li><li data-target="#myCarousel" data-slide-to="2"></li>/ol><div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>')
        temp.appendTo("body");
        $.support.transition =  false
        stop()

        $('.carousel-indicators [data-slide-to="1"]').click()
        temp.trigger('mouseover')

        temp.on('slide', function(){
            alert('slid')
            ok(true, 'carousel slid once')
            $('.carousel').on('slide', function(){
                alert('slide again')
                ok(false, 'caroisel slid again')
            })
            start()
        })
      })

maybe someone can help me out with these tests?

@fat
Copy link
Member

fat commented Dec 26, 2012

rather than listening to mouseover, i think it would be better to just check if the carousel is paused before calling cycle

@fat
Copy link
Member

fat commented Feb 6, 2013

hm that seems to be fixed… 

the carousel shouldn't transition when you're hovering the arrows – and doesn't currently in 2.3 (at least i can't reproduce)

thanks man

@fat fat closed this Feb 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants