62,074
社区成员
发帖
与我相关
我的任务
分享
//++
// Navigation dropdowns
//++
GE_Nav = function(el) {
this.el = $(el);
this.a = null;
this.subNav = null;
this.index = null;
this.init();
}
GE_Nav.itemIndex = 0;;
GE_Nav.shimEl = null;
GE_Nav.searchedCurrentLiEl = false;
GE_Nav.prototype.init = function() {
var hasChildren = this.el.hasClassName("hasChildren");
if (hasChildren) {
this.index = GE_Nav.itemIndex++;
// if (!/WebKit/i.test(navigator.userAgent)) { // sniff out Safari and disable drop-down menus
this.el.observe("mouseover", this.doOver.bindAsEventListener(this) );
this.el.observe("mouseout", this.doOut.bindAsEventListener(this) );
this.el.observe("focus", this.show.bind(this) );
this.el.observe("blur", this.hide.bind(this) );
// } else {
// with drop-downs disabled, safari has -1px top margin shift because of lack of border.
// these observes will remove that style on hover.
// this.el.observe("mouseover",function(){this.el.down().setStyle({backgroundPosition:'50% -24px'});}.bind(this));
// this.el.observe("mouseout",function(){this.el.down().setStyle({backgroundPosition:'50% 1px'});}.bind(this));
// }
this.subNav = this.el.getElementsBySelector(".navSubItem")[0];
if (this.subNav) {
this.a = this.el.down().cloneNode(true);
var li = $(document.createElement('li'));
li.appendChild(this.a);
if (this.el.hasClassName('currentItem') && !this.el.hasClassName('currentParent')) { li.addClassName('currentItem') }
if(this.a.innerHTML != 'Submit an Idea' && this.a.innerHTML != 'Contact Information'){ //don't do this for submit an idea and contact info
this.subNav.insertBefore(li,this.subNav.down());
}
var subNavWrapper = $(document.createElement('div'));
subNavWrapper.addClassName('currentItem');
if ($('ge_skipToContent')) subNavWrapper.appendChild($('ge_skipToContent'));
subNavWrapper.appendChild(this.subNav);
$("ge_navigation").appendChild(subNavWrapper);
}
}
}
GE_Nav.prototype.doOver = function(e) {
if (GE_detectMouseEnter(this.el,e)) {
this.show();
}
Event.stop(e);
return false;
}
GE_Nav.prototype.doOut = function(e) {
if (GE_detectMouseLeave(this.el,e)) {
this.hide();
}
Event.stop(e);
return false;
}
GE_Nav.prototype.show = function() {
this.el.addClassName('activeItem');
var html = ddcontent[this.index];
new Insertion.After(this.el.down(), html);
var newEl = this.el.down().next();
if (this.el.id=="nav_products_services") {
var elGroupLI = newEl.immediateDescendants();
// elGroupLI.pop().remove(); //remove this line to add last element (A-Z index) back
var numLI = elGroupLI.length;
var rowCount = 5; // Math.floor(numLI/3);
// var remainder = numLI%3;
var index = 0;
for (var r=0;r<3;r++) {
var elLI = new Element('li',{className:'navGroup'});
var elGroupUL = new Element('ul');
// var c = (0<remainder--)?rowCount+1:rowCount;
for (var n=0;n<rowCount;n++) {
if (index >= numLI) break;
elGroupUL.appendChild(elGroupLI[index++]);
}
elLI.appendChild(elGroupUL);
newEl.appendChild(elLI);
}
}
// find images in innovation dropdowns and append baselink to them
if (this.el.id=='nav_innovation') {
// var imgEls = newEl.select('img');
// imgEls.each(function(el){
// el.writeAttribute('src',GE_baselink+el.readAttribute('src'));
// });
Cufon.replace('#subnav_innovation .button_link');
}
if (/MSIE/i.test(navigator.userAgent)) {
var shimEl = this.getShimEl();
Position.clone(newEl, shimEl);
shimEl.setStyle({zIndex:"1", visibility:"inherit" });
}
}
GE_Nav.prototype.hide = function() {
this.el.removeClassName('activeItem');
var tmp = this.el.down().next();
if (tmp) { tmp.remove(); }
// this.el.down().next().remove();
if (/MSIE/i.test(navigator.userAgent)) {
this.getShimEl().setStyle({visibility:"hidden"});
}
}
GE_Nav.prototype.getShimEl = function() {
if (GE_Nav.shimEl==null) {
GE_Nav.shimEl = new Element( "iframe", {style:"visibility:hidden;background:white;position:absolute; top:0px; left:0px;", frameBorder:"0", scrolling:"no"});
//GE_Nav.shimEl.src="://";
GE_Nav.shimEl.src=GE_baselink+"html_view/blank.htm";
//GE_Nav.shimEl.setOpacity(.01);
document.body.appendChild(GE_Nav.shimEl);
}
return GE_Nav.shimEl;
}
GE_Main.mapFnToCSS("navItem",GE_Nav);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页导航</title>
<LINK rel=stylesheet type=text/css href="base.css">
<SCRIPT type=text/javascript src="ge.js"> </SCRIPT>
<SCRIPT type=text/javascript src="ge_init.js"> </SCRIPT>
</head>
<body>
<DIV id=ge_navigation><UL class=navContainer>
<LI id=nav_home class="currentItem navItem firstItem "><A title=Home href="index.html">Home</A></LI>
<LI id=nav_innovation class="hasChildren navItem"><A title=Innovation href="innovation/index.html">Innovation</A></LI>
<LI id=nav_products_services class="hasChildren navItem"><A title="Products & Services" href="products_services/index.html">Products & Services</A></LI>
<LI id=nav_our_company class="hasChildren navItem"><A title="Our Company" href="company/index.html">Our Company</A></LI>
<LI id=nav_news class="hasChildren navItem"><A title=News href="news/index.html">News</A></LI>
<LI id=nav_investor_relations class="hasChildren navItem"><A title="Investor Relations" href="investors/index.html">Investor Relations</A></LI>
<LI id=nav_careers class="hasChildren navItem"><A title=Careers href="careers/index.html">Careers</A></LI>
<LI id=nav_directory class="navItem "><A title=Directory href="directory/index.html">Directory</A></LI>
<LI id=nav_contact class="hasChildren navItem "><A title="Contact Information" href="contact/index.html">Contact Information</A></LI>
<LI id=nav_submit_an_idea class="hasChildren navItem lastItem "><A title="Submit an Idea" href="contact/submit_an_idea/index.html">Submit an Idea</A></LI></UL>
<SCRIPT type=text/javascript>//<![CDATA[
var ddcontent = [
'<div class="navDropdown" id="subnav_innovation"><div><p>The power of imagination put to real-world challenges.</p><a class="button_link" href="/innovation/archive.html" title="View All">View All</a></div><ul><li><a href="/innovation/emr/index.html" title=""><img src="/ge_images/feature-emr-nav.jpg" alt="Together, We Can Make Health Better"/></a></li><li><a href="/innovation/" title=""><img src="/ge_images/feature-american-renewal-nav.jpg" alt="Generating the ideas that generate jobs"/></a></li><li><a href="/innovation/generations/index.html" title=""><img src="/ge_images/feature-generations-nav.jpg" alt="Five Generations, One GE Family"/></a></li></ul></div>','<ul class="navDropdown" id="subnav_products_services"><li><a href="products_services/appliances.html" title="Appliances">Appliances</a></li><li><a href="products_services/aviation.html" title="Aviation">Aviation</a></li><li><a href="products_services/consumer_electronics.html" title="Consumer Products">Consumer Products</a></li><li><a href="products_services/electrical_distribution.html" title="Electrical Distribution">Electrical Distribution</a></li><li><a href="products_services/energy.html" title="Energy">Energy</a></li><li><a href="products_services/finance_business.html" title="Finance – Business">Finance – Business</a></li><li><a href="products_services/finance_consumer.html" title="Finance – Consumer">Finance – Consumer</a></li><li><a href="products_services/healthcare.html" title="Healthcare">Healthcare</a></li><li><a href="products_services/lighting.html" title="Lighting">Lighting</a></li><li><a href="products_services/media_entertainment.html" title="Media & Entertainment">Media & Entertainment</a></li><li><a href="products_services/oil_gas.html" title="Oil & Gas">Oil & Gas</a></li><li><a href="products_services/rail.html" title="Rail">Rail</a></li><li><a href="products_services/security.html" title="Security">Security</a></li><li><a href="products_services/water.html" title="Water">Water</a></li><li><a href="products_services/directory/by_product.html" title="A – Z Index">A – Z Index</a></li></ul>','<ul class="navDropdown" id="subnav_our_company"><li><a href="company/citizenship/index.html" title="Citizenship">Citizenship</a></li><li><a href="company/research_development.html" title="Research & Development">Research & Development</a></li><li><a href="company/worldwide_activities/index.html" title="Worldwide Activities">Worldwide Activities</a></li><li><a href="company/leadership/index.html" title="Leadership">Leadership</a></li><li><a href="company/governance/index.html" title="Governance">Governance</a></li><li><a href="company/culture/index.html" title="Our Culture">Our Culture</a></li><li><a href="company/history/index.html" title="Our History">Our History</a></li><li><a href="company/advertising/index.html" title="Advertising">Advertising</a></li></ul>','<ul class="navDropdown" id="subnav_news"><li><a href="http://www.genewscenter.com/content/default.asp?NewsAreaID=2" title="Press Releases">Press Releases</a></li><li><a href="news/ge_in_the_news/index.html" title="GE in the News">GE in the News</a></li><li><a href="news/our_viewpoints/index.html" title="Our Viewpoints">Our Viewpoints</a></li><li><a href="audio_video/ge/featured/" title="Audio & Video">Audio & Video</a></li><li><a href="news/olympic_games/index.html" title="Olympic Games">Olympic Games</a></li><li><a href="news/download_library/index.html" title="Download Library">Download Library</a></li><li><a href="news/newsfeeds/index.html" title="Newsfeeds">Newsfeeds</a></li><li><a href="news/contacts/index.html" title="Press Contacts">Press Contacts</a></li></ul>','<ul class="navDropdown" id="subnav_investor_relations"><li><a href="investors/stock_info/index.html" title="Stock Information">Stock Information</a></li><li><a href="investors/financial_reporting/index.html" title="Financial Reporting">Financial Reporting</a></li><li><a href="investors/events/index.html" title="Events & Presentations">Events & Presentations</a></li><li><a href="investors/shareholder_services.html" title="Shareholder Services">Shareholder Services</a></li><li><a href="investors/personal_investing/index.html" title="Personal Investing">Personal Investing</a></li><li><a href="investors/investing/index.html" title="Institutional Investing">Institutional Investing</a></li><li><a href="investors/investor_updates.html" title="Investor Updates">Investor Updates</a></li><li><a href="investors/investor_contacts.html" title="Investor Contacts">Investor Contacts</a></li></ul>','<ul class="navDropdown" id="subnav_careers"><li><a href="careers/job_search.html" title="Job Search">Job Search</a></li><li><a href="careers/why_ge.html" title="Why GE">Why GE</a></li><li><a href="careers/life_at_ge/index.html" title="Life at GE">Life at GE</a></li><li><a href="careers/students/index.html" title="University Students">University Students</a></li><li><a href="careers/veterans/index.html" title="U.S. Military Veterans">U.S. Military Veterans</a></li></ul>','<ul class="navDropdown" id="subnav_contact"><li><a href="contact/index.html" title="Contact Information">Contact Information</a></li><li><a href="contact/contact_form.html" title="Feedback & Inquiries">Feedback & Inquiries</a></li></ul>','<ul class="navDropdown" id="subnav_submit_an_idea"><li><a href="contact/submit_an_idea/index.html" title="Submit an Idea">Submit an Idea</a></li><li><a href="contact/submit_an_idea/sai_terms.html" title="Terms of Submission">Terms of Submission</a></li><li><a href="contact/submit_an_idea/how_to.html" title="How to Submit">How to Submit</a></li><li><a href="contact/submit_an_idea/compensation/index.html" title="Compensation">Compensation</a></li><li><a href="contact/submit_an_idea/sai_forms/index.html" title="Submission Form">Submission Form</a></li></ul>'
];
//]]></SCRIPT>
</DIV>
</body>
</html>