为神马木有效果呢?帮忙给瞅瞅
为神马木有效果呢?帮忙给瞅瞅
2015-06-20
错误太多了,改了半天…………
首先你的锚点就没写完啊
【
<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】混用的,这个是咋也不可能会有效果的。
类似粗心的地方还有好几处,建议自己细心检查一遍先。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ;( 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) |
举报