Find Position of CSS Background

I am working on a script to find the position of a css background, 

the css code is something like :-

<li id="mainSignal" style="background-% -68px;"></li>

I am looking to find the values 50% or -68px and when they change.

I have tried :-

$result = Invoke-WebRequest -uri $url 
$result.ParsedHtml.getElementById to find this value. 

any tips would be greatly appreciated.

June 22nd, 2015 9:16am

"position"?

Get the element.  Look at the style attribute.

$el=$result.ParsedHTML,GetElementById('mainSignal')

Post a link to a page with an example if you want more.

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 9:49am

Many thanks for the reply,

Unfortunately I don't have a url to send, its an internal page.

The background is larger than the box its displayed in, so I am using its position to decide what part of the image is displayed.

This I can then translate to a percentage or something.

in

$el.style I have no information so I must be asking the wrong way.

K

June 22nd, 2015 10:12am

Set the image style to either fit to the container or set the container to "clip" the image.  It is dynamic and automatic.  If you asked your question in a web forum for CSS/HTML you would get the answers you need.  PowerShell cannot help you with this.

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 10:33am

This is what i am trying to write in Powershell, something like this...

I know the CSS element I am after, I am having trouble with the posh retrieving the values.

http://stackoverflow.com/questions/6821746/how-do-i-get-the-background-position-y-in-firefox-using-jquery

K

June 23rd, 2015 6:48am

In PowerShell you are dealing with a different document model than in jquery.

style.backgroundposition

http://www.w3schools.com/cssref/pr_background-position.asp

Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 10:10am

Hi K,

Im writing to just check in to see if the suggestions were helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.

If you have any feedback on our support, please click here.

Best Regards,

Anna Wang

July 9th, 2015 5:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics