Move site actions to the left

21.02.2010: Updated the post with the code for floating the site action menu to the right on the screen (as requested by Larry).

This one proved a bit tricky because the site action menu is part of the master page.

See codeblock below for updated code. Please let me know if you find any bugs.


After i posted the solution to Move view selector to the left, i got a request from Charlie Epes for the same solution regarding the “Site Actions-menu”.

This is the default placement of the Site Actions-menu:
IMG

Here the menu is inserted after the last toplink (dynamic):
IMG


Here is how it’s done
Add a CEWP below the list view, and add this code (alter the location of the jQuery-scipt as needed)
[javascript]
<script type="text/javascript" src="../../Javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$("table.ms-bannerframe table:first td:last").after($("table.ms-bannerframe td:last"));
</script>
[/javascript]

Code for floating the menu to the right (replace the code supplied above with this one):
[javascript]
<script type="text/javascript" src="../../Javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
// Site action float right
$(document).ready(function(){
setTimeout(function(){
siteActionFloatRight();
},500);
});

function siteActionFloatRight(){
var menuWidth = $("table.ms-siteaction").width();
var doc = $(document).width();
var win = $(window).width();
var scr = $(window).scrollLeft();

left = doc-win-scr+menuWidth;
if(left<120){
left=100;
}
// Move the site action menu to the new position
$("table.ms-siteaction").css({‘position’:’absolute’,’top’:0,’left’:-left});
}

// Handle resize and scroll
$(window).resize(function() {
siteActionFloatRight();
}).scroll(function() {
siteActionFloatRight();
});

// Make it adapt to changing document width due to expanding groups
$("td[class^=’ms-gb’]").click(function(){
setTimeout(function(){
siteActionFloatRight();
},250);
});
</script>
[/javascript]

Regards
Alexander

8 thoughts on “Move site actions to the left”

    1. Hi,
      This one proved a bit more tricky as the site action menu is part pf the master page and does not want to be moved around like the view selector.

      I have made it 90%, but it requires some more testing before it is “released”.

      Alexander

Leave a Reply