I have component which needs a slider. I`ve chosed carousel but how to add it in the frontend part of the component on installation ? Tried to put it in the administrator part but the scripts can't be reached this way.
Your component has a manifest file (component_name.xml). In that file you list the files you want the installer to upload and locate.
So you create a section that looks something like this:
<media destination="com_whatever" folder="media"> <folder>js</folder> </media>
That tells the installer to install the folder 'js' into /media/com_whatever area of Joomla (do I really need to point out that you need to substitute your component's name for com_whatever?) so it can be ready for use.
Then in the template for the view for your controller (front-end) you can ensure Joomla adds that js by calling addScript to add your script to the list.
You want to do it that way because that will allow a user to override your choice as part of a general template override for your component (and please don't be That Guy who thinks the way they want the output to look is the only right and proper way for it to look -- let the user have some say in the design and layout of their own site).