2016-08-30 5 views

ответ

0

Изменить .css("margin-left") в .css("marginLeft").

Like This:

$(document).ready(function(){ 

    if ($car1.css("marginLeft") == "1060px") 

     $("#result").html("Car One Won The Race!!"); 

}) 

Окончательный код:

<html> 
 
    <title>This is test</title> 
 
    
 
    <head> 
 
     <style> 
 
      div { 
 
       margin-left: 1060px; 
 
      } 
 
     </style> 
 
    </head> 
 
    <body> 
 
     
 
     <div>I am div, and margin_left 1060px</div> 
 
     <p id="result"></p> 
 
     
 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 
     <script> 
 
      
 
     $(document).ready(function(){ 
 
      $car1 = $("div"); 
 
      if ($car1.css("marginLeft") == "1060px") 
 

 
       $("#result").html("Car One Won The Race!!"); 
 

 
     }) 
 
     </script> 
 
    </body> 
 
</html>

+0

это работает :) – arifCoder

Смежные вопросы