1. Accordion for Left Navigation in sharepoint 2010
Make sure "addClass" fuction will be after "this", add has('ul') for the folder that doesnt have child to be linkable not acordion
<script src="/Style%20Library/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("div.menu-vertical>ul.root>li.static:has('ul')>a").toggle(
function () {
$(">ul", $(this).addClass("t-active").parent()).show("fast");
},
function () {
$(">ul", $(this).removeClass("t-active").parent()).hide("fast");
}
);
$("div.menu-vertical>ul.root>li.static>ul.static").css("display","none");
});
</script>
2. Find a text and replace it by white space, add class
<script type="text/javascript">
$(document).ready(function () {
$('.menu-horizontal span.menu-item-text:contains("الرئيسية")').addClass('home');
$('.menu-horizontal span.menu-item-text:contains("الرئيسية")').html(function(i, h) {
return h.replace('الرئيسية', '');
});
});
</script>
3. Add a content (image,..) inside a tag (div...) with parent function
to get multiple level of parent we can use parent().parent().parent()
$(document).ready(function () {
$('.menu-horizontal span.menu-item-text:contains("الرئيسية")').parent().prepend('<img src="/Style Library/en-us/images/icon-home.gif" width="15px"></img>');
});
Make sure "addClass" fuction will be after "this", add has('ul') for the folder that doesnt have child to be linkable not acordion
<script src="/Style%20Library/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("div.menu-vertical>ul.root>li.static:has('ul')>a").toggle(
function () {
$(">ul", $(this).addClass("t-active").parent()).show("fast");
},
function () {
$(">ul", $(this).removeClass("t-active").parent()).hide("fast");
}
);
$("div.menu-vertical>ul.root>li.static>ul.static").css("display","none");
});
</script>
2. Find a text and replace it by white space, add class
<script type="text/javascript">
$(document).ready(function () {
$('.menu-horizontal span.menu-item-text:contains("الرئيسية")').addClass('home');
$('.menu-horizontal span.menu-item-text:contains("الرئيسية")').html(function(i, h) {
return h.replace('الرئيسية', '');
});
});
</script>
3. Add a content (image,..) inside a tag (div...) with parent function
to get multiple level of parent we can use parent().parent().parent()
$(document).ready(function () {
$('.menu-horizontal span.menu-item-text:contains("الرئيسية")').parent().prepend('<img src="/Style Library/en-us/images/icon-home.gif" width="15px"></img>');
});
No comments:
Post a Comment