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?
- wp_enqueue_script() with unknown path and maybe symlink
- 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
- How Do I Use jQuery UI In My Plugin
- Remove profile picture option (and other things) from profile.php (in admin)
- Load js/css files only on specific admin UI pages
- Get list of scripts / styles and show file which enqueued them
- Test to see if jQuery or Prototype is queued by another plugin?
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- Hook the Keydown Event in the TinyMCE Post Editor
- How do I conditionally enqueue script for CPT single post type with plugin?
- Which method is best to enqueue scripts
- Add a jQuery function to admin pages
- Where to enqueue stylesheets for plugin?
- How to Add a .js file Only in one specific Page Dynamically to Head
- Help adding image upload functionality to widget
- How to trap “Publish” button to check for meta box validation?
- When is it too late to call the action wp_enqueue_scripts?
- Script won’t load via plugin class
- Plugin Loading Scripts and Styles on Every Page – Even when not being used
- Using Ajax call in jQuery doesn’t work in widget
- 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 you output enqueued scripts to an admin page?
- How do I add a javascript file to all admin pages via a plugin?
- Multisite plugin development and wp_enqueue_script
- Ajax in WordPress – path issue
- is_page() function doesnt working
- Mixing Regular Javascript With jQuery in a Plugin
- How to avoid loading same script twice?
- Loading jQuery and jQuery plugin script files correctly [duplicate]
- 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]
- Enqueue scripts in footer
- Loading scripts with wp_register_script and wp_enqueue_script
- Add a row on clicking each post featured image
- Adding Dropbox dropin js using wp_enqueue_script
- Where to call wp_enqueue_script in a plugin with custom template?
- how to add Jquery script to one page?
- 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?
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- how to search users by ajax live search
- jQuery selectors for editor elements safe to use?
- Display WordPress the_content() via data attributes
- How to enqueue or include json file to a plugin
- javascript datatables in a plugin
- jQuery for custom plugin not working with Divi theme
- WordPress custom taxonomy check box to dropdown
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- How to load library scripts in admin from plugins in noConflict wrapper?
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- Create shortcode to echo javascript
- Enqueue script globally
- jQuery in WordPress Plugin
- 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
- jQuery instantly executes (a button click and css change) on load
- How to include jQuery into my plugin so I can use it on plugin page?
- How to import the css in the plugin admin area?
- Ajax submit result opens in admin-ajax.php
- My stylesheets are not enqueuing
- Plugin Development – Class Constructor Not Firing wp_enqueue_style action hook
- Custom Plugin – CSS works, JS doesn’t
- Enqueuing scripts and styles in custom plugins
- how to get the post id in plugin
- Jquery was not found on this server
- insert query on a custom table using ajax with jQuery plugin Jeditable
- unable to wp_enqueue_script(‘suggest’);
- making a plugin that moves other plugins wp_head actions to wp_footer
- 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?
- How to make my shortcode load scripts and styles, from within the plugin?
- WP ajax requests not stacking?
- Need help about understand api, wp, $ syntax in WordPress plugin script
- Plugin path comes wrongly