XF 2.1 JS or Cache Issue

Ozzy47

Well-known member
So I have a addon that adds some JS to the message_macros template. This creates a slider of images that are loaded as thumbnails. It works as expected.
js1.png

Now the issue I am facing is if you edit that post, no matter what you change in it, or changing nothing, once you save, the slider images are missing.
js2.png

Once you do a page refresh, the slider works again. Here is the code I add to the message_macro template:
HTML:
<xf:css src="lightslider.less" />
<xf:js src="vendor/lightslider/lightslider.js" min="1" />
<xf:js src="OzzModz/AttachEnhancment/slider/slider.js" />
<ul class="attachmentList" data-xf-init="item-slider" data-xf-item-slider='{"auto":{$xf.options.ozzmodz_attachenhancment_slider_auto},"loop":{{$xf.options.ozzmodz_attachenhancment_slider_loop?"true":"false"}},"pager":{$xf.options.ozzmodz_attachenhancment_slider_page},"item":{$xf.options.ozzmodz_attachenhancment_slider_item}}'>

What can I do to make the slider work after editing the post?
 
Last edited:
My guess would be that the slider calculates its dimensions based on the parent container. During initialization of the slider, the post will be hidden (as it'll expand in an animation afterwards), so the calculation may come up with a height of 0. Without seeing the DOM, I can't make any definitive statement though.
 
My guess would be that the slider calculates its dimensions based on the parent container. During initialization of the slider, the post will be hidden (as it'll expand in an animation afterwards), so the calculation may come up with a height of 0. Without seeing the DOM, I can't make any definitive statement though.

Could I send the addon to you in a PC so you can have a look in your spare time?
 
Hmm, I am seeing a lot of the following error in my server error logs (nginx with pagespeed enabled):
Code:
... /img/controls.png" failed (2: No such file or directory) ...
I searched admincp templates for that file, and came up with lightslider.css.

Related? Are you getting any such entries in your server log?
 
Hmm, I am seeing a lot of the following error in my server error logs (nginx with pagespeed enabled):
Code:
... /img/controls.png" failed (2: No such file or directory) ...
I searched admincp templates for that file, and came up with lightslider.css.

Related? Are you getting any such entries in your server log?

same

lightslider.less:

background-image: url('../img/controls.png');

but this file and folder do not exist, I downloaded fresh copy of Xenforo and the file doesn't exist

any ideas?
 
Back
Top Bottom