Not totally sure, but sometimes IE has some issues with scoping and what-not
when you leave off 'var' from your variable declarations.
On Jun 29, 2012, at 12:52 PM, Stephanie Meyer wrote:
> Any idea why this code doesn’t work in IE?
>
> <script type="text/javascript">
> $(document).ready(function() {
> switchers = $('#switchers > li');
> states = $('#state_info > div');
> switchers.each(function(idx) {
> $(this).data('state', states.eq(idx));
> }).click(
> function() {
> switchers.removeClass('active');
> states.removeClass('active');
> $(this).addClass('active');
> $(this).data('state').addClass('active');
> });
> });
> </script>
>
> I have an unordered list with an id of “switchers”. The li’s act as anchors
> to toggle the content within a separate “state_info” div (swaps divs of
> content with the “state_info” div..the visible content div has a class of
> “active”). I’m not sure if it matters but it’s worth noting that the
> “switchers” ul is nested in a div, with an id of “map”, which is at the same
> level of hierarchy as the “state_info” div, so “switchers” and “state_laws”
> are not at the same parental level...if you understand what I’m trying to say
> :)
>
> To better explain (in case there is a better solution), the page is meant to
> display state laws per state via a map. The li’s of “switchers” are
> positioned absolutely over the states of the map. When the user clicks the
> state, the individual state’s laws appear in a box below the map. here is the
> full page of code: https://gist.github.com/3019523 (don't critiquing the
> mark-up, unless there is something detrimental to the functionality...I know
> that there is some scripting I could do to eliminate redundant code)
>
> I’m not sure what about the code above doesn’t work with IE. Please help.
> Thanks in advance!
> -Steph M
>
> --
> Our Web site: http://www.RefreshAustin.org/
>
> You received this message because you are subscribed to the Google Groups
> "Refresh Austin" group.
>
> [ Posting ]
> To post to this group, send email to [email protected]
> Job-related postings should follow http://tr.im/refreshaustinjobspolicy
> We do not accept job posts from recruiters.
>
> [ Unsubscribe ]
> To unsubscribe from this group, send email to
> [email protected]
>
> [ More Info ]
> For more options, visit this group at
> http://groups.google.com/group/Refresh-Austin
--
Our Web site: http://www.RefreshAustin.org/
You received this message because you are subscribed to the Google Groups
"Refresh Austin" group.
[ Posting ]
To post to this group, send email to [email protected]
Job-related postings should follow http://tr.im/refreshaustinjobspolicy
We do not accept job posts from recruiters.
[ Unsubscribe ]
To unsubscribe from this group, send email to
[email protected]
[ More Info ]
For more options, visit this group at
http://groups.google.com/group/Refresh-Austin