逐梦凡
2015-06-20 02:12
为神马木有效果呢?帮忙给瞅瞅
错误太多了,改了半天…………
首先你的锚点就没写完啊
【
<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】混用的,这个是咋也不可能会有效果的。
类似粗心的地方还有好几处,建议自己细心检查一遍先。
;(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">提 醒</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">提 醒</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 问题
相似问题
回答 3
回答 1