jQuery animate() doesn't work in Firefox or Internet Explorer -


i'm working on having 3 boxes animate , display text when clicked. when 1 clicked, others move down allow space display text. when middle clicked, other 2 move down clicked 1 moves left side.

my problem while works fine in webkit browsers, in firefox , internet explorer boxes don't animate down , out of way when text appears. seems though i've done that's dependent on way webkit works, far can tell code pretty standard.

edit: here jsfiddle http://jsfiddle.net/captainspectacular/zlndm/10/, reason not recreate problem i'm having on site.

here jquery function:

function selectbox($box) {      switch($box) {     case 'brand':             $('.brand-identity').animate({top : 0}, 300)                 .animate({left : 40}, 300)             $('.web').animate({top : 270, left : 340}, 300);             $('.print-design').animate({top : 270, left : 640}, 300);             toggletext('brand');             break;         case 'web':             $('.web').animate({top : '0px'}, 300).animate({left : '40px'}, 300);             $('.brand-identity').animate({top : '270px'}, 300)                 .animate({left : '40px'}, 300);             $('.print-design').animate({top : '270px' }, 300)                 .animate({left : '640px'}, 300);             toggletext('web');             break;         case 'print':             $('.web').animate({left : '340px'}, 300)                 .animate({top : '270px'}, 300);             $('.brand-identity').animate({top :'270px'}, 300)                 .animate({left : '40px'}, 300);             $('.print-design').animate({top : '0px'}, 300)                 .animate({left : '640px'}, 300);             toggletext('print');             break;     } } 

(toggletext decides text div show/hide based on input string)

and html supposed affect:

<div class="services-box-container">     <div class="services-box brand-identity">         <img class="brand-color"src="/images/services/brand-icon-color.png">         <p>brand<br/>identity</p>     </div>      <div class="brand-text">         <p>brand text</p>     </div> </div>  <div class="services-box-container">     <div class="services-box web">         <img class="web-color"src="/images/services/web-icon-color.png">         <p>web</p>     </div>  <div class="web-text">     <p>web text</p> </div>                       </div>  <div class="services-box-container">     <div class="services-box print-design">         <img class="print-color"src="/images/services/print-icon-color.png">         <p>print<br/>design</p>     </div>      <div class="print-text">         <p>print text</p>                        </div>                       </div> 

and css boxes:

.services-box {     top: 0;     position: absolute;     width: 230px;     height: 230px; } .brand-identity {     top: 0;     left: 40px; } .web {     top: 0;     left: 340px; } .print-design {     top: 0;     left: 640px;  } 

the problem if statement left out of jsfiddle in order simplify it. interaction meant take place in full screen window on desktop, inside each click event handler was:

if(document.width > 960){     //event handling } 

this not work because firefox , ie return "undefined" attribute.

i tried changing screen.width, seems return width of monitor, , window.width gave same result document.width. solution use actual jquery $(window).width(), returns same results browsers.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -