The answer is to use wp_register_style() and wp_enqueue_style() before I do wp_register_script() and wp_enqueue_script() so that I can use relative image paths to the CSS file. I then move the url() stuff from jQuery and into the CSS file with this relative path.
Related Posts:
- ajaxurl not defined on front end
- How to add a javascript snippet to the footer that requires jQuery
- How to include jQuery and JavaScript files correctly?
- jQuery in header or footer
- Use js script from one plugin in another plugin
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- WP Plugin Running before jQuery
- should i be checking for jquery before enqueing it in a plugin
- How to enqueue scripts in right way in a plugin?
- Using function from enqueued .js file in theme in plugin?
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- Script work on non logged in user but not work for logged in user?
- How to get the path to the current theme?
- Why does WordPress use outdated jQuery v1.12.4?
- How to enqueue JavaScripts in a plugin
- Symbolic Links on dev box with plugins and stylesheets
- Remove profile picture option (and other things) from profile.php (in admin)
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- Hook the Keydown Event in the TinyMCE Post Editor
- How to trap “Publish” button to check for meta box validation?
- Plugin Loading Scripts and Styles on Every Page – Even when not being used
- wp_enqueue_style built in styles
- What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]
- Plugin base URL
- Admin-ajax.php appending a status code to ajax response
- Plugin admin page meta_box toggle and order state not saving
- WordPress plugin options and jQuery
- Inserting JS snippet in the footer if there is no wp_footer?
- Can’t get JS code to work with shortcode
- How do I add a javascript file to all admin pages via a plugin?
- Mixing Regular Javascript With jQuery in a Plugin
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- jquery document ready function not being called [closed]
- Loading scripts with wp_register_script and wp_enqueue_script
- Add a row on clicking each post featured image
- Where to call wp_enqueue_script in a plugin with custom template?
- Replacing Scripts in Admin Load_Scripts
- Is there a way to ensure plugin script loads before another script?
- Is there an event or an other method that tells me the preview is loaded?
- conditionally load javascript & CSS for do_action() calls from plugin
- What stylesheets are available in core?
- jQuery for custom plugin not working with Divi theme
- How to load library scripts in admin from plugins in noConflict wrapper?
- Create shortcode to echo javascript
- Enqueue script globally
- jquery & ajax sending data to php
- wp_localize_script is not adding a global variable for javascript
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- How to import the css in the plugin admin area?
- Ajax submit result opens in admin-ajax.php
- My stylesheets are not enqueuing
- Enqueuing scripts and styles in custom plugins
- how to get the post id in plugin
- Jquery was not found on this server
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- WP ajax requests not stacking?
- Plugin path comes wrongly
- How to get post image root URL?
- Insert Into Post Not Working For Audio File Using jQuery
- jquery in wordpress plugin with depdendency
- ajax working when function is on child theme but not in plugin page
- Enqueue a file that’s not js or css
- How to overwrite iris color pallates from theme to plugin
- Ajax +wordpress onClick link redirect to new page and create html content
- Thickbox in Plugin settings page?
- Enqueue scripts inside a class in a plugin
- Enqueue ONLY Plugin Styles and Scripts
- wp_enqueue_scripts in a plugin’s class
- WordPress Plugin Authoring question about jquery and css
- How to deal with different jQuery versions?
- Get cat parameter from admin-ajax
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- wp.media gallery collection sometimes undefined
- escape html in jQuery for WordPress
- Jquery php request is returning a weird result
- Is “document loaded” different on admin side than public side?
- $ is not defined [duplicate]
- plugin css is not being applied to the page
- Adding External Gmap JS to WordPress
- WordPress Ajax not returning Response
- How do I ensure I can loop through every enqueued script and CSS?
- How to avoid conflict if a plugin already have included open library?
- Javascript not being loaded only in custom taxonomy template
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Ajax Response Error | just getting error as the response
- Enqueue scripts based on site.
- replacing jquery google cdn with a new version dynamically
- How can I add the Post ID to Class Name in Jquery?
- Enqueue script not working
- Template file structure , wordpress hook for altering the template
- How do I call the dashboard’s sortable javascript in a plugin page?
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- Enqueue Script in custom plugin before other
- Loading jQuery library from WordPress admin
- How to only Load scripts on variable products page
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- How to get the value entered in the input field in wordpres
- How to access Elementor-navigation-elements via jQuery
- Insert meta-description into Yoast-SEO input-field via JavaScript