jquery - Javascript get element background image BUT eliminate the "url()" -


ive been working on image gallery ive been creating myself , im adding "zoom in" feature it.

i know im close succeeding have 1 tiny issue. in javascript managed background property of image enlarged grabs image including url(). want url (http:.../) excluding url().

i hope isn't confusing if are, link project. click on image zoom in, alerts background-image property because wanted see fetches first.

check out

is possible?

the simple solution slice method. first parameter specifies start selection, second specifies end selection end of string if it's negative. so, code should be:

var bkimg = window.getcomputedstyle(sourceimg,null).getpropertyvalue("background-image"); var bkimgurl = bkimg.slice(4, -1); 

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -