I am trying to implement a jQuery plugin. Code is available on jsFiddle. http://jsfiddle.net/MKL4g/1/ , but I also copied my modifications below.
var postsArr = new Array(),
$postsList = $('div.cat-children ul');
$postsList.find('li').each(function(){
postsArr.push($(this).html());
})
var firstList = postsArr.splice(0, Math.round(postsArr.length / 2)),
secondList = postsArr,
ListHTML = '';
function createHTML(list){
ListHTML = '';
for (var i = 0; i < list.length; i++) {
ListHTML += '<li>' + list[i] + '</li>'
};
}
createHTML(firstList);
$postsList.html(ListHTML);
createHTML(secondList);
$postsList.after('<ul class="cat-list"></ul>').next().html(ListHTML);
I implement this on the Joomla 3.0.2 website using the Gantry 4.1.5 platform.
The CSS for creating the resulting UL LI array is as follows (LESS Format):
body {
&.menu-face-à-la-crise,
&.menu-divorce-séparation,
&.menu-études-de-cas,
&.menu-effets-de-la-vie-séparée,
&.menu-effets-du-divorce,
&.menu-effets-communs,
&.menu-situations-particulières,
&.menu-formulaires-modèles,
&.menu-suppléments-addendas,
&.menu-à-propos-de-nous {
div#rt-mainbody-surround {
margin-top: -1px;
background: @whitebrown;
}
div.component-content {
.blog {
li {
text-align: center;
font-family: @headingFontFamily;
font-weight: 700;
font-size: 2.0em;
line-height: 1.5em;
text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}
div.cat-children {
ul {
float: left;
padding: 10px;
}
}
}
}
}
}
The following error appears in the console:
TypeError: "null" is not an object (evaluate to "$ postsList.find")
You can see the implementation here:
http://gobet.ergonomiq.net/études-de-cas/effets-du-divorce
As you can see, it does not seem to accept list items and splits them into two columns.
, .
- , ?