CSS-Tricks / MovingBoxes

Simple horizontal slider which grows up the current box when it's in focus (image, title & text) and back down when it's not in focus.
http://css-tricks.github.io/MovingBoxes/
GNU Lesser General Public License v3.0
280 stars 147 forks source link

Disable scroll when refresh (F5) triggered #50

Closed aguieb closed 12 years ago

aguieb commented 12 years ago

I have the following...

$('#slider-two').movingBoxes({ startPanel : 1,
width : 500, wrap : false, panelWidth : .7, buildNav : true, navFormatter : function(index, panel){ return panel.find('h2 span').text(); } });

When I click on the F5 button I don't see the scroll animation. But when I change the wrap variable to "true" and I click F5, I see the scroll animation run. How do I turn off the default scroll animation when F5 or page is loaded? I like it when I don't see the animation run by default.

Please advice.

thanks!

Mottie commented 12 years ago

I'm not quite sure what you are asking... pressing f5 reloads the page. So are you talking about the initial scrolling that MovingBoxes does? Have you tried setting the hashTags to false? Doing that will prevent the URL from updating with the current slide and thus, the slider should start on the first panel, or which ever panel you have set as the startPanel.

Are you wanting to completely disable the initial scrolling?

aguieb commented 12 years ago

Yes I am talking about the initial scrolling that MovingBoxes does when the page reloads when the wrap is set to true. I want to completely disable the initial scrolling. I tried setting the hashTags to false but it still scrolled on page load. When wrap variable is set to false the initial scrolling does not occur on page load. So I am trying to see we can disable the initial scroll when wrap is set to true. Thanks for replying so fast!

Mottie commented 12 years ago

Ah ok, I understand. Try these settings (demo)

$('#slider').movingBoxes({

    // animation time in milliseconds
    speed: 0,

    // e = event, slider = MovingBoxes Object, tar = current panel #
    // callback when MovingBoxes has completed initialization
    initialized: function(e, slider, tar){
        slider.options.speed = 500;
    }

});
aguieb commented 12 years ago

Thank you! Your suggestion works. Once again thank you for your prompt response on all my questions.

Mottie commented 12 years ago

Update: A new option named initAnimation was added in version 2.2.3. When set to false, MovingBoxes will initialize on the set startingPanel or hash tag panel without animation The above code is no longer needed.