We help IT Professionals succeed at work.
Get Started

anythingSlider starts on the last slide in IE

630 Views
Last Modified: 2012-05-11
I've added the CSS-Tricks anythingSlider to a page - it works correctly in Firefox and Chrome but in IE8, it starts on the last element instead of the first. This is a known bug apparently - Googling got me this...
---
When AnythingSlider is initialized on a hidden element, the last slide will show instead of the first. This is because a scrollLeft value cannot be applied to a hidden element. So either initialize it with visibility hidden, or if that isn't possible, then set the scrollLeft when it becomes visible:

    var s = $('#slider1').data('AnythingSlider');
    s.$window.scrollLeft( s.$window.width() + s.easingMargin ); // may not work if resizeContents is false (width will vary)

Can anyone explain how I implement this in my page, please? (not being a JavaScript/JQuery guru). I have a sample page here... http://www.cobwebbery.co.uk/anything/page.html which demonstrates the problem. I've obviously not done it correctly because I get an error '$window is null or not an object'

I've selected 250 points not because it looks like a huge problem but simply because I've got a client who needs this on Monday morning. BTW as you'll see from the site, the order of the slide is very important, so they must display in the correct order.

Many thanks



Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 11 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE