Hi SitePoint Community,
Good day to everyone! I just want to ask your expert advice on how will I implement a dynamic CSS in my file browsing application. The application is using Laravel PHP, JQUERY and SQLIite. My code is something like this:
for (var i = 0; i<contentdivs.length; i++){
var parentDir = ($(contentdivs[i]).children().next().next().attr('id'));
if(checkFlag === 0){
if(nextSubDir === parentDir){
if((!filecheck1) && (!filecheck2)){
checkFlag = 1;
$("div a#contentFolders").filter('.'+refDirectory).eq(i).after(filedetails) .after(directories);
}
}
}
}
and the appended by after in this function ( $("div a#contentFolders").filter('.'+refDirectory).eq(i).after(filedetails) .after(directories); )
is coming from this function;
function foldersDisplay(directorynames, newId) {
return (
$( "<div class='contentFolders' id="+newId+">" + directorynames + "</div>" ).css({"margin-left":"20px"})
);
}
function filesDisplay(filenames) {
return (
$( "<div class='contentFiles'>" + filenames + "</div>" ).css({"margin-left":"20px"})
);
}
The filenames values are coming from my Laravel cotroller that has this value and format:
<a id="contentFOlders"><img></img><img></img><span><strong>FOLDERNAMENAME<strong></span><span>FOLDERSIZE</span><span>DATE</span></a>
<a id="contentFILes"><img></img><img></img><span><strong>FILENAME<strong></span><span>FOLDERSIZE</span><span>DATE</span></a>
I am trying to append the values from my controller inside a container that is dynamically indenting if the folders or directories are moving deeper. However, since this is inside a div that I put a css of margin left. The whole div is getting out inside the container as the div is continualy indenting. COuld you help me how whould I apply dynamic CSS on this.
Thanks and best regards,
Warly