jquery - Getting and Setting CSS() not working...Toggle Height -


I'm basically trying to toggle height from 50px to 200px. I have written this code to check whether the height is 50px, if it is set to 200, then some other value of it sets it to 50. Basically a toggle facton

  $ ('Click this row (function () {console.log ("+" ($ "' .- -This '). CSS (' Css ('height', '50')) {$ ('this line'). CSS ('height', '200')} and ('' height '')); CSS ('height' '50')});  

I have this in the beginning of CSS. This line {height: 50px}. Examines the height and sets to 200, but the opposite logic is not working on the next click

You are using setter in your position, so you are always making the height 50px before testing. Try it:

  if ($ (' Css ('height', '200'), and $ ('.in-row'). ). CSS ('height', '50')});  

You can minimize it using a threesome:

  $ row $ $ ('. -This-row'); $ Row.css ('height', $ row.css ('height') == '50'? '200': '50');  < / Pre> 

Or even better, with markup completely Using a class:

  $ ( '. This-row '). ToggleClass ('Long');  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -