This is something like jquery selectbox
. For positioning the div
replacing select
, used offset()
. I measure the width and height of selektov. As a result, divs are normally displayed. But the problem is that divas were higher than selektov. And lower them below, I can not. With z-index: -1;
they leave for content. How to transfer click from diva to select?
Here is the code:
// click send to replacer $('select').click(function(e) { $(this).next('.sel-wrapper').trigger('click'); // это не работает }); $('select').each(function(index, element) { var realSelect = $(this); if(!(realSelect.next('.sel-wrapper').length)){ realSelect.after('<div class="sel-wrapper"><div class="sel-body"></div><div class="sel-btn"></div></div>'); } // dimensions var selWrapper = realSelect.next('.sel-wrapper'); selWrapper.width(realSelect.width()); selWrapper.height(realSelect.height()); selWrapper.css({'border':'1px solid violet'}); // position var selectPos = realSelect.offset(); selWrapper.offset({top: selectPos.top, left: selectPos.left});