java script or a condition ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alexey™
    Member
    • Oct 2008
    • 78
    • 3.8.x

    java script or a condition ?

    Is there any Js or a vB condition that i can set an ads to be shown only in computers that their resolution is lower than 1024?



    can you tell me if this script is correct?

    Code:
    <script type="text/javascript">
    if (screen.width>1024)
    {
     document.write(MY ADD CODE IS HERE);
    }
    </script>
  • Floris
    Senior Member
    • Dec 2001
    • 37767

    #2
    You determine screen resolution with a javascript.
    You can not do this with an template conditional from vBulletin.

    Code:
    <script type="text/javascript" charset="utf-8">
        if (screen.width>=1024)
        {
         // code here for 1024 or bigger
        }
        else
        {
          // code here for lower than 1024.
        }
        
    </script>

    Comment

    • Alexey™
      Member
      • Oct 2008
      • 78
      • 3.8.x

      #3
      I noticed that it's working only in The FF browser and aint working in IE.

      why is that?

      Comment

      • Floris
        Senior Member
        • Dec 2001
        • 37767

        #4
        win7/ie8, works fine here under vmware.

        Comment

        • Alexey™
          Member
          • Oct 2008
          • 78
          • 3.8.x

          #5
          Tnx guys but i made a new js page and then i fix it by my self.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...