context.js 右键菜单demo

$(document).ready(function(){
    
    context.init({preventDoubleContext: false});//初始化
    
    context.attach('.inline-menu', //这是定位,写成html则整个页面的右键都是这个,覆盖原有浏览器右键

[
        {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: 'http://contextjs.com/context.js', target:'_blank', action: function(e){
                _gaq.push(['_trackEvent', 'ContextJS Download', this.pathname, this.innerHTML]);
            }}
        ]},
        {text: 'The Styles', subMenu: [
        
            {text: 'context.bootstrap.css', href: 'http://contextjs.com/context.bootstrap.css', target:'_blank', action: function(e){
                _gaq.push(['_trackEvent', 'ContextJS Bootstrap CSS Download', this.pathname, this.innerHTML]);
            }},
            
            {text: 'context.standalone.css', href: 'http://contextjs.com/context.standalone.css', 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: '@jakiestfu'},
            {text: 'Website', href: 'http://jakiestfu.com/', target: '_blank'},
            {text: 'Forrst', href: 'http://forrst.com/people/jakiestfu', target: '_blank'},
            {text: 'Twitter', href: 'http://twitter.com/jakiestfu', 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://omglilwayne.com/', 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});
    });
    
});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值