为神马木有效果呢?帮忙给瞅瞅

来源:4-5 编程练习

逐梦凡

2015-06-20 02:12

为神马木有效果呢?帮忙给瞅瞅

写回答 关注

2回答

  • 脆脆鲨oi
    2015-06-25 15:42:55
    已采纳

    错误太多了,改了半天…………

    首先你的锚点就没写完啊

    <li><a href="#" class="current">1F 男装</a></li>

    <li><a href="#">2F 女装</a></li>

    <li><a href="#">3F 美妆</a></li>

    <li><a href="#">4F 数码</a></li>

    <li><a href="#">5F 母婴</a></li>

    <li><a href="#item1" class="current">1F 男装</a></li>

    <li><a href="#item2">2F 女装</a></li>

    <li><a href="#item3">3F 美妆</a></li>

    <li><a href="#item4">4F 数码</a></li>

    <li><a href="#item5">5F 母婴</a></li>


    代码里面粗心写错的地方太多了,比如【var current="";】,但你后面是【current】和【currentId】混用的,这个是咋也不可能会有效果的。

    类似粗心的地方还有好几处,建议自己细心检查一遍先。

    脆脆鲨oi 回复逐梦凡

    不客气^_^。很多时候不是咱们写的不对,而是一些小地方粗心写错。督促自己更加细心一些^_^

    2015-06-26 11:49:57

    共 2 条回复 >

  • jweikai
    2015-06-20 10:44:51
    ;(function($) {   
        $.myalerts = {
            lock: 'myAlert_lock',     
            srollBarWidth: 75,
            popupId: 'myAlert_popup_container',
            alert: function(message, title, callback) {
                if( title == null ) title = '提醒'
                $.myalerts._show(title, message, 'alert', callback);
            },
            _show: function(title, message, type, callback) {
                $.myalerts._showLock();
                $.myalerts._setProperty(title,message);
                $.myalerts._confirmEvent();
            },
            _init: function() {          
                $lock = $("<div id="+$.myalerts.lock+"></div>");
                $lock.css({
                    background: '#000000',
                    opacity: 0.5,
                    position: 'absolute',
                    top: '0',
                    left: '0',
                    zIndex: 99990,
                    width: $(document).width(),
                    height: $(document).height(),
                    display: 'none'
                });                
                $('body').css({
                    margin: 0,
                    padding: 0,           
                }).append($lock).append('<div id="myAlert_popup_container"><dl><dt class="title">提&nbsp;醒</dt><dd class="message"</dd><dd class="pos-right"><input type="button" value="确定" /></dd></dl></div>');
                var $popup = $("#"+$.myalerts.popupId);
                $popup.css({
                    left: $(window).width()/2-$("#"+$.myalerts.popupId).outerWidth()/2,
                    top: $(window).height()/2-$("#"+$.myalerts.popupId).outerHeight()/2
                });
                $(window).on({
                    resize: function() {
                        $lock.css({
                            width: $(window).width(),
                            height: $(document).height()  
                        });
                    }
                });
            },
            _showLock: function() {
                var $lock = $("#"+$.myalerts.lock);
                var $popup = $("#"+$.myalerts.popupId);
                $lock.css({
                    display: 'block',
                    opacity: 0.5
                });    
                $popup.css({
                    display: 'block'
                });    
            }, 
            _setProperty: function(title, message) {
                var $popup = $("#"+$.myalerts.popupId);
                $popup.find('.title').html(title).end().find('.message').html(message);
            },
            _confirmEvent:function() {
                var $popup = $("#"+$.myalerts.popupId);
                var $lock = $("#"+$.myalerts.lock);
                $popup.find(":button").click(function() {
                    $popup.fadeOut(200, function() {
                        $popup.css({
                            display: 'none'
                        });
                    });
                    $lock.fadeOut(200, function() {
                        $lock.css({
                            display: 'none',          
                        });
                    });
                });        
            }
        };
        $.myalerts._init();
        myAlert = function(message, title, callback) {
            $.myalerts.alert(message, title, callback);
        }  
    })(jQuery)
    ;(function($) {   
        $.myalerts = {
            lock: 'myAlert_lock',     
            srollBarWidth: 75,
            popupId: 'myAlert_popup_container',
            alert: function(message, title, callback) {
                if( title == null ) title = '提醒'
                $.myalerts._show(title, message, 'alert', callback);
            },
            _show: function(title, message, type, callback) {
                $.myalerts._showLock();
                $.myalerts._setProperty(title,message);
                $.myalerts._confirmEvent();
            },
            _init: function() {          
                $lock = $("<div id="+$.myalerts.lock+"></div>");
                $lock.css({
                    background: '#000000',
                    opacity: 0.5,
                    position: 'absolute',
                    top: '0',
                    left: '0',
                    zIndex: 99990,
                    width: $(document).width(),
                    height: $(document).height(),
                    display: 'none'
                });                
                $('body').css({
                    margin: 0,
                    padding: 0,           
                }).append($lock).append('<div id="myAlert_popup_container"><dl><dt class="title">提&nbsp;醒</dt><dd class="message"</dd><dd class="pos-right"><input type="button" value="确定" /></dd></dl></div>');
                var $popup = $("#"+$.myalerts.popupId);
                $popup.css({
                    left: $(window).width()/2-$("#"+$.myalerts.popupId).outerWidth()/2,
                    top: $(window).height()/2-$("#"+$.myalerts.popupId).outerHeight()/2
                });
                $(window).on({
                    resize: function() {
                        $lock.css({
                            width: $(window).width(),
                            height: $(document).height()  
                        });
                    }
                });
            },
            _showLock: function() {
                var $lock = $("#"+$.myalerts.lock);
                var $popup = $("#"+$.myalerts.popupId);
                $lock.css({
                    display: 'block',
                    opacity: 0.5
                });    
                $popup.css({
                    display: 'block'
                });    
            }, 
            _setProperty: function(title, message) {
                var $popup = $("#"+$.myalerts.popupId);
                $popup.find('.title').html(title).end().find('.message').html(message);
            },
            _confirmEvent:function() {
                var $popup = $("#"+$.myalerts.popupId);
                var $lock = $("#"+$.myalerts.lock);
                $popup.find(":button").click(function() {
                    $popup.fadeOut(200, function() {
                        $popup.css({
                            display: 'none'
                        });
                    });
                    $lock.fadeOut(200, function() {
                        $lock.css({
                            display: 'none',          
                        });
                    });
                });        
            }
        };
        $.myalerts._init();
        myAlert = function(message, title, callback) {
            $.myalerts.alert(message, title, callback);
        }  
    })(jQuery)


网页定位导航特效

本课程讲解网页定位导航特效,仿天猫版地狗购物网,你值得拥有

71404 学习 · 486 问题

查看课程

相似问题