/    Sign up×
Community /Pin to ProfileBookmark

page.winW=function()
{ with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) };
page.winH=function()
{ with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) };
page.scrollX=function()
{ with (this) return MS?win.document[db].scrollLeft:win.pageXOffset };
page.scrollY=function()
{ with (this) return MS?win.document[db].scrollTop:win.pageYOffset };

function repositionMenus(mN) { with (this)
{
var menu = this.menus[mN].lyr;

// Showing before measuring corrects MSIE bug.
menu.sty.display = ‘block’;
// Reset to and/or store original margins.
if (!menu._jsm_origML) menu._jsm_origML = menu.ref.currentStyle ?
menu.ref.currentStyle.marginLeft : (menu.sty.marginLeft || ‘auto’);
if (!menu._jsm_origMT) menu._jsm_origMT = menu.ref.currentStyle ?
menu.ref.currentStyle.marginTop : (menu.sty.marginTop || ‘auto’);
menu.sty.marginLeft = menu._jsm_origML;
menu.sty.marginTop = menu._
jsm_origMT;

// Calculate absolute position within document.
var menuX = 0, menuY = 0,
menuW = menu.ref.offsetWidth, menuH = menu.ref.offsetHeight,
vpL = page.scrollX(), vpR = vpL + page.winW() – 16,
vpT = page.scrollY(), vpB = vpT + page.winH() – 16;
var mp = page.elmPos(menu.ref);

// Compare position to viewport, reposition accordingly.
var mgL = 0, mgT = 0;

if (mp.x + menuW > vpR)
{
// mgL = -menuW ;
if(this.menus[mN].par.lyr.ref.offsetWidth > menuW);
{
mgL = – menuW-27;
}
}
if (mp.x + mgL < vpL) mgL = vpL – mp.x;
if (mp.y + menuH > vp? mgT = vpB – mp.y – menuH ;
if (mp.y + mgT < vpT) mgT = vpT – mp.y;

if (mgL) menu.sty.marginLeft = mgL + ‘px’;
if (mgT) menu.sty.marginTop = mgT + ‘px’;
}};

// Set this to process menu show events for a given object.
//addEvent(listMenu, ‘show’, repositionMenus, true);
here is the javascript function for the menu
th eproblem if the extreme left most menu crosses the viewport the corresponding submenus should displat at the left side.plz say whether it is possible or not f possible plz send me the function.
THANKS,
Lavanya.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @lavanya_nakka spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.9,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...