I have this code below, and my links user1 and user 2 with a dropdown menu, and the links are not working nothing happens when i clik.
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(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-3').removeClass('active');
});
});
<script src="http://ift.tt/Sw98cH"></script>
<section class="main">
<div class="wrapper-demo">
<div id="dd" class="wrapper-dropdown-3" tabindex="1">
<span class="span">user</span>
<ul class="dropdown">
<li> <a class="itemm" href="#">user1</a>
</li>
<li> <a class="itemm" href="#">user2</a>
</li>
</ul>
</div>
</div>
</section>
The link just works with click with the right button and open in othe tab
Aucun commentaire:
Enregistrer un commentaire