X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   How to add CSS for custom module. (https://forum.x-cart.com/showthread.php?t=77230)

rahuljat 10-02-2019 05:25 AM

How to add CSS for custom module.
 
Hello,

I have created custom module in XCart5. I have also added module setting code for adding HTML. So Is there any way to include css and js withing module directory. I have tried this reference way: https://devs.x-cart.com/design_changes/adding_css_and_js_files.html
But my custom module stopped working after adding this reference code.

So can you please suggest how can I add CSS for particular module within module files.

Thanks,

Ed B. 10-02-2019 09:36 AM

Re: How to add CSS for custom module.
 
I have recently used the method you refer to and it works (on X-cart version is 5.4.0.5, but the documentation is for older versions, so it should also work for 5.3.6.3) , so probably you have spelling problem or something.

rahuljat 10-03-2019 05:18 AM

Re: How to add CSS for custom module.
 
Hi,

Thanks for your reply.

Actually now, my css and js are included on website but css is not applied on DOM element(like div).

Can you please suggest on what I am doing wrong.

Thanks,

Ed B. 10-03-2019 11:00 PM

Re: How to add CSS for custom module.
 
Is it the CSS rules that aren't applied, or JS not making necessary changes on dom elements so that the css apply?

rahuljat 10-03-2019 11:06 PM

Re: How to add CSS for custom module.
 
Hi,

Actually CSS rules are aren't applied on DOM Element. JS is working fine.

I have debug the code and got that if I use list=body than CSS is included but not applied and if I use list=layout.main than it start working.

I didn't understand why this happens.

Can you please suggest why my CSS not applied with list=body.

Thanks,

Ed B. 10-04-2019 12:12 AM

Re: How to add CSS for custom module.
 
Presumably it is because there are rules from XC or other modules that apply to list=layout.main and they have priorities as layout.main is more specific than body.

rahuljat 10-04-2019 12:16 AM

Re: How to add CSS for custom module.
 
Ok thanks, means we are not able to apply css if we use list=body.

There is no way to apply css on element if we use list=body in module.

Ed B. 10-04-2019 04:43 AM

Re: How to add CSS for custom module.
 
From /skins/customer/body.twig
Code:

# Please note that any custom list child of 'body' will NOT have its CSS/JS resources loaded because the resources block is being 'body' child itself. Use 'layout.main' or 'layout.footer' instead.


All times are GMT -8. The time now is 10:56 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.