How to shorthand if else in jQuery function?

What is the method for writing an animate function of jquery for a div tag which gets applied on two different screen sizes?

  • I want to write animate function for an element (e.g. a DIV element) that should get applied for a particular screen size. For example: I wrote .animate function for default screen size (e.g. for 1280 width screen). Now I want to write another .animate function which should get applied when the screen size is of width= 500px. How can I write the condition or the logic for it?

  • Answer:

    Not getting exactly what you are asking,but if I'm not wrong what you need is CSS Media queries. Read this : http://css-tricks.com/css-media-queries/ https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries

Amit Choubey at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.