3 Replies - 593 Views - Last Post: 09 October 2012 - 07:42 AM

#1 kaine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 18-March 09

Not adding class to body in IE

Posted 03 October 2012 - 11:52 AM

I am an extreme novice when it comes to writing code. All I want to do is detect if an element is there and if so add a custom class to the body tag.

Here is my code:

$(document).ready(function() {
    if($("input#discount_code").length > 0) {
              $("body").addClass("discount");
          }

     else if($("#dtnav_buttons>#backbutton~#next").length > 0) {
              $("body").addClass("confirm");
          }
          
     else {
            $("body").addClass("no-discount");
            }
});



Here is a link to the site:
register.groundbreakingweb.com

What am I doing wrong?

Is This A Good Question/Topic? 0
  • +

Replies To: Not adding class to body in IE

#2 kaine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 18-March 09

Re: Not adding class to body in IE

Posted 03 October 2012 - 12:06 PM

I left out some important info.

You have to click the register links to really see whats going on. The different body classes are used to style the form using nth-of-type.

It will work when you click the link sometimes, but if you refresh the styles go away.

sorry for not posting this at first.
Was This Post Helpful? 0
  • +
  • -

#3 sas1ni69  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 85
  • View blog
  • Posts: 431
  • Joined: 04-December 08

Re: Not adding class to body in IE

Posted 08 October 2012 - 07:15 PM

Hi there,

Quick questions, is it working on other browsers? What version of IE are you using?
Was This Post Helpful? 0
  • +
  • -

#4 kaine  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 18-March 09

Re: Not adding class to body in IE

Posted 09 October 2012 - 07:42 AM

After looking into it I think there it is an issue with selectivizr. I am using the latest version of Gantry for Joomla in responsive mode. I think it has something to do with the combination of nth-of-type, media queries and selectivizr. I still can't find a fix though.

It works every other refresh is ie7, 8 and 9
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1