How to get just one parameter in 'clip' CSS property using JQuery? [duplicate]

Tags: javascript,jquery,html,css

Problem :

This question already has an answer here:

this is a really short question, but needed:

I need to get just one parameter of this 'clip' CSS property

clip:rect(260px, 160px, 260px, 0px);

in this case I'd need to get the '260px' parameter only and set it equal to a variable 'x', how do I get that one only?

Remember I'm using Jquery :)

Solution :

You'll need to do some string manipulation on the property:

var clip = $("#bulb_light").css("clip"); // rect(260px 160px 260px 0px)
var clipTop = clip.split(' ')[0].replace("rect(", ""); // 260px

    CSS Howto..

    CSS: can't understand how to work with the z-index

    why is .show() making the target div appear at top of page?

    How can that view be achieved? Collage / Magazine Products

    How to Flip Div's in Randomly

    How to make different font families appear same size? (computationally)

    How to provide a stylesheet for rendering PDFs?

    How to align elements equally in a line in CSS/Bootstrap?

    Css Tricks - How to align 4 div's

    How to change iframe pages without the parent page changing with external links using CSS

    CSS: How to shrink first div in container instead of going outside of container

    Once nav bar reached top of window, how to keep it there?

    How to change scrollbar in textarea input?

    How to set background-color to the length of the test in a jQuery UI accordion?

    How to apply jQuery on css selector :before [duplicate]

    How to create a similar background to this one

    Table borders not showing correctly

    How to design HTML header

    How to use bootstrap-theme.css with bootstrap 3?

    How to organize CSS - table columns

    How to make a website look like a Windows Office application? [closed]

    TUMBLR CSS - How to move the caption on the permalink page to the right of the image

    How to make Visual Studio stop “compiling” .js and .css files

    How could I use pseudo-element :after :before conditionally

    How to use jQuery's flag to swap CSS display property

    CSS display: table - How can I line up two cells to be in the center of another DIV using display: table?

    How to change the color of table rows once ng-repeat executed

    how to define multiple classes' hover event in css?

    CSS Horizontal Menu has wrong x-position, how to put directly under parent menu?

    How can I use css files in django?

    how can i force all rows in a table to have the same height