自定义多层级连网页右键
![自定义多层级连网页右键 自定义多层级连网页右键](https://i-blog.csdnimg.cn/blog_migrate/899f6e69e59fb4c3fcfadf59dc843bef.jpeg)
XML/HTML Code
- <div id="download">Right Click to Demo <span class="amp">&</span> Download</div>
JavaScript Code
- $(document).ready(function(){
- context.init({preventDoubleContext: false});
- context.attach('.inline-menu', [
- {header: 'Options'},
- {text: 'Open', href: '#'},
- {text: 'Open in new Window', href: '#'},
- {divider: true},
- {text: 'Copy', href: '#'},
- {text: 'Dafuq!?', href: '#'}
- ]);
- context.attach('#download', [
- {header: 'Download'},
- {text: 'The Script', subMenu: [
- {header: 'Requires jQuery'},
- {text: 'context.js', href: '#', target:'_blank', action: function(e){
- _gaq.push(['_trackEvent', 'ContextJS Download', this.pathname, this.innerHTML]);
- }}
- ]},
- {text: 'The Styles', subMenu: [
- {text: 'context.bootstrap.css', href: '#', target:'_blank', action: function(e){
- _gaq.push(['_trackEvent', 'ContextJS Bootstrap CSS Download', this.pathname, this.innerHTML]);
- }},
- {text: 'context.standalone.css', href: '#', target:'_blank', action: function(e){
- _gaq.push(['_trackEvent', 'ContextJS Standalone CSS Download', this.pathname, this.innerHTML]);
- }}
- ]},
- {divider: true},
- {header: 'Meta'},
- {text: 'The Author', subMenu: [
- {header: '@freejs'},
- {text: 'Website', href: 'http://www.freejs.net/', target: '_blank'},
- {text: 'freejs', href: 'http://www.freejs.net', target: '_blank'},
- {text: 'Donate?', action: function(e){
- e.preventDefault();
- $('#donate').submit();
- }}
- ]},
- {text: 'Hmm?', subMenu: [
- {header: 'Well, thats lovely.'},
- {text: '2nd Level', subMenu: [
- {header: 'You like?'},
- {text: '3rd Level!?', subMenu: [
- {header: 'Of course you do'},
- {text: 'MENUCEPTION', subMenu: [
- {header:'FUCK'},
- {text: 'MAKE IT STOP!', subMenu: [
- {header: 'NEVAH!'},
- {text: 'Shieeet', subMenu: [
- {header: 'WIN'},
- {text: 'Dont Click Me', href: 'http://freejs.net/', target:'_blank', action: function(){
- _gaq.push(['_trackEvent', 'ContextJS Weezy Click', this.pathname, this.innerHTML]);
- }}
- ]}
- ]}
- ]}
- ]}
- ]}
- ]}
- ]);
- context.settings({compress: true});
- context.attach('html', [
- {header: 'Compressed Menu'},
- {text: 'Back', href: '#'},
- {text: 'Reload', href: '#'},
- {divider: true},
- {text: 'Save As', href: '#'},
- {text: 'Print', href: '#'},
- {text: 'View Page Source', href: '#'},
- {text: 'View Page Info', href: '#'},
- {divider: true},
- {text: 'Inspect Element', href: '#'},
- {divider: true},
- {text: 'Disable This Menu', action: function(e){
- e.preventDefault();
- context.destroy('html');
- alert('html contextual menu destroyed!');
- }},
- {text: 'Donate?', action: function(e){
- e.preventDefault();
- $('#donate').submit();
- }}
- ]);
- $(document).on('mouseover', '.me-codesta', function(){
- $('.finale h1:first').css({opacity:0});
- $('.finale h1:last').css({opacity:1});
- });
- $(document).on('mouseout', '.me-codesta', function(){
- $('.finale h1:last').css({opacity:0});
- $('.finale h1:first').css({opacity:1});
- });
- });
原文地址: http://www.freejs.net/article_jquerywenzi_169.html