我在这里找到了一个下拉列表:http: //tympanus.net/codrops/2012/10/04/custom-drop-down-list-styling/
HTML:
<ul class="dropdown" tabindex="1">
<li><a href="/user/profile">profile</a></li>
<li><a href="/user/logout">log out</a></li>
</ul>
此时的js:
function DropDown(el) {
this.dd = el;
this.placeholder = this.dd.children('span');
this.opts = this.dd.find('ul.dropdown > li');
this.val = '';
this.index = -1;
this.initEvents();
}
DropDown.prototype = {
initEvents : function() {
var obj = this;
obj.dd.on('click', function(event){
$(this).toggleClass('active');
return false;
});
obj.opts.on('click',function(){
var opt = $(this);
obj.val = opt.text();
obj.index = opt.index();
obj.placeholder.text('profile: ' + obj.val);
});
},
getValue : function() {
return this.val;
},
getIndex : function() {
return this.index;
}
}
$(function() {
var dd = new DropDown( $('#dd') );
$(document).click(function() {
// all dropdowns
$('.wrapper-dropdown-1').removeClass('active');
});
});
When the dropdown items are selected text is being placed into the parent ul selection instead of going to the page I'd like it to. 这个简单的下拉菜单一切正常,我只需要禁用用所选文本替换链接的部分。我只希望锚标签能像任何人一样正常工作。
错误信息:
try
84 {
85 if ( ! class_exists($prefix.$controller))
86 {
87 throw new HTTP_Exception_404('The requested URL :uri was not found on this server.',
88 array(':uri' => $request->uri()));
89 }
90
91 // Load the controller using reflection
92 $class = new ReflectionClass($prefix.$controller);