If Statement is sorting true/false - jQuery -


I have a statement that does not seem to work as if I would prefer it. I was thinking that someone could help me.

  var image_url = jQuery ('# bgImgWrap'). CSS ('background'), image; If (image_url [1]) {console.log (image_url.length); // url () Remove or image_url = image_url.match (/ url \ ([^)] + \) /) [0]; in the case of Chrome URL (""); Var imgRegExp = / \ (([^)] +) \) /; Image_url = imgRegExp.exec (image_url); Image_url = image_url [1]; Image = new image (); // Just in case it does not load jQuery (image) already. Load (function () {// Background image is smaller than window size, then set background to cover // Always set to cover mobile if (jQuery (window) .Width ()> Image. Method | | JQuery (window) .it ()> Image .high || jQuery (window) .with () <940) {jQuery ("# ​​bgImgWrap"). Backstrech (Image_url);} Other {jQuery (" # BgImgWrap "). CSS (" Background Size "," Auto ");}}); Image.src = image_url;  

My problem with this code is that it is grabbing the image and letting it shape me for the background without any problem, but image_url Returns the string such as:

  RGB (255, 255, 255) url (http: // localhost: 8000 / mysite / images / our_Services2.jpg) No-double scrolling 0% / auto padding -box limit-box  

and image_url [1] to the string url . After taking this step for the first time, it only excludes leaving url part:

  RGBA (0, 0, 0, 0) No repeat scrolling 0% 0% / Auto padding-box limit-box  

So if the statement does not work because it is checking that any image_url [1] is there But it does not contain url and then my code is correct due to an error:

  rgba (0, 0, 0, 0)  

is saying: Uncounted Type ArrayLL zero The property '0' can not be read

P> My question is, is it possible to check if image_url [ 1] Contains the narrow url ? If not, then does anyone know better why to fix my problem?


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 -