filter by colour ( image ) ajax issue
-
I will have many colour images to be uploaded to my site & i noticed the plugin requires you to uplaod a separate image for each colour if the colour is an image.
to overcome this, i wrote some jQuery ( below ), which finds the data name and places it in the image url.
this works, however, upon clicking ‘Apply Filters’ or ‘Reset filters’, the styling goes away and the colour images disappear.Please can you tell me, which ajax calls i need to use to fix this.
The following is my code that effectively sets the colour images upon initial load of the filter.jQuery(function(){ jQuery('.bapf_body ul > li').each(function() { var getCol = jQuery('input', jQuery(this)).data('name'); var imageUrl = "https://website/wp-content/uploads/2021/10/" + getCol + ".jpg"; jQuery(".bapf_img_span", jQuery(this)).css('background-image', 'url("' + imageUrl + '")'); console.log('CSS background-image =', jQuery(".bapf_img_span", jQuery(this)).css('background-image')); }); });
the type of attribute ( image ) is made available by another plugin, but i really just need to know which ajax calls i need to make custom code for to prevent the styling from disappearing.
thank you
- This topic was modified 3 years ago by .
- This topic was modified 3 years ago by .
- This topic was modified 3 years ago by .
The page I need help with: [log in to see the link]
- The topic ‘filter by colour ( image ) ajax issue’ is closed to new replies.