Include background-image url css in jquery string

Include background-image url css in jquery string

By : WaelFST
Date : November 21 2020, 11:01 PM
I think the issue was by ths following , The string breaks because the opening single quotation mark after [style=] ends at [url(]. Since the string already contains both single quotation marks aswell as double quotation marks, you have to escape the 3rd.
code :
$(".wrapper").append("<div class='slide bgimage' style='background-image: url('img/" + img + ".jpg');'></div>");
$(".wrapper").append("<div class='slide bgimage' style='background-image: url(\"img/" + img + ".jpg\");'></div>");
var field = {
	img: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/140626_Tierser_Alpl_Rossz%C3%A4hne.jpg/245px-140626_Tierser_Alpl_Rossz%C3%A4hne"

var img=field.img;
 $(".wrapper").append("<div class='slide bgimage' style='background-image: url(\"" + img + ".jpg\");'></div>");
.slide {display:inline-block;width:400px;height:400px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="wrapper"></div>

Share : facebook icon twitter icon
Can i use jquery to manipulate css to change background image with base64 string

Can i use jquery to manipulate css to change background image with base64 string

By : Maviz
Date : March 29 2020, 07:55 AM
seems to work fine Here's the problem. i've a base64 image string which is dynamically retrieved from database via ajax. , try:
code :
$('#dragBox').css('background-image', 'url(' + base64_string + ')');
Does a background image size include the border?

Does a background image size include the border?

By : Shaldon Heuer
Date : March 29 2020, 07:55 AM
may help you . Background images display within the constraints of the border — that is to say the border is not included in the space that the background displays over (it will display over padding, though).
It may be helpful to your particular case to use background-size: cover (MDN reference)?
include background image using javascript

include background image using javascript

By : Jozef Kosik
Date : March 29 2020, 07:55 AM
Any of those help i want to apply background image with no repeat using javascript.. , Try this:
code :
$('#img_name').css('background-image', 'url("assets/images/"'+data['img_name']+'")');
$('#img_name').css('background-repeat', 'no-repeat');
    'background-image' : 'url("/assets/images/'+data['img_name']+'")',
    'background-repeat': 'no-repeat'
How to include an image in leaflet as the background job

How to include an image in leaflet as the background job

By : NickS
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further L.tileLayer() is for a Tile Source (basically, could be a folder with thousands of image parts, each corresponding to a portion of your high resolution image, with different zoom levels).
If you have a single high resolution image that you could not (or do not want to) cut into thousand tiles, you should rather use L.imageOverlay()
How do I set the background image of a div to include the margins

How do I set the background image of a div to include the margins

By : Varaprasad Somasekha
Date : March 29 2020, 07:55 AM
like below fixes the issue Actually margin leave the space from outside boundary so theoretically this is impossible but we can overcome it using pseudo-classes. See following link I updated your css [here][1].
code :
  [1]: https://jsfiddle.net/h1madb61/2/
Related Posts Related Posts :
  • Javascript normal Array value and Array value created by match function comparison
  • pass a value from javascript to html and codeigniter
  • how to perform div hover shows another div but both div's are different form?
  • Draw a buffer with subbuffers webgl
  • Call a function on click event in Angular 2
  • Object.assign getters and setters in constructor
  • Have to set Number of Threads, Ramp up Period and Loop count from an external properties file
  • Post data from javascript to php file using ajax doesn't work
  • How to access method in prototypal inheritance pattern?
  • Q: How do I make each div fade away individually?
  • JavaScript/jQuery: how to get HTML and display HTML, including tags
  • Controller not loading if javaScript containing controller code is added dynamically to HTML dom
  • TypeError while retriving prototype properties
  • Google Maps API: adding zip code boundaries
  • Validating date with current date using jquery
  • ComponentWillMount keeps being called repeately
  • Laravel URL Generator With Angular JS Varible
  • Post data to another php page using ajax
  • Progressbar behavior depending on checkboxes bootstrap + jquery
  • node.js/socket.io/express execution order
  • nested EJS tag. Not working
  • Service call in controller in AngularJs using ES6
  • Div that acts as file upload?
  • Load D3 Url With API key
  • Read data in JSON format asp.net View in MVC
  • How to make separate force layout render loop?
  • Download a JSON behind a login page with nightmare
  • Regex to scan for a specific number of a repeating character
  • Array push still using previous reference?
  • Javascript context.closePath() method does not appear
  • Javascript variable undefined even after defining in Express Js, mongo db
  • How to add hover effect to <table> using CKEditor?
  • Autocomplete List Fixed Position Browser Resize
  • RegEx trying to match anything but a certain pattern with chars from the pattern being allowed
  • Validating value in HTML number input with Konva
  • Is any class object serializable in javascript?
  • 'content-type': 'text/html' not accepted until server is killed
  • Vue js Ready function is not triggered
  • setInterval wont work if timing is too short
  • Do reserved words need to be quoted when set as property names of JavaScript objects?
  • How to specify (optional) default props with TypeScript for stateless, functional React components?
  • reactjs render array of objects into a list gives an error
  • Todo list takes 30 seconds to appear
  • Reformat JSON objects inside an array to show them in HTML
  • can not route with angularjs
  • Running a script in a site that copies all keys pressed while the page is open
  • Using jQuery to select div with class signed by ruby iteration
  • Using classList when element is set to display none
  • Ionic 2 Express call not responding to user update function
  • How to optimize jQuery.getJSON() for geolocalisation
  • Vue 2.0 setting up routes - Do not use 'new' for side effects
  • In JavaScript, how to update attributes with jQuery
  • JSON Data not appearing on marker in Google map
  • Why appendChild is not working with node type?
  • Javascript function results
  • Add multiple callback responses to array
  • Parsley's EXCLUDED not recognizing :last
  • Make javaScript (not JQuery!) "activate" on keypress a CSS button:active style
  • forEach for Uint8ClampedArray
  • How to sent results of request to client browser in node.js
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com