2016-07-05 6 views
0

선택 상자가 닫히는 데 문제가 있습니다. 사이트의 에는 두 개의 선택 요소가 있습니다.바깥 쪽을 클릭하면 선택 상자가 닫힙니다.

첫 번째 작품 : 열리고 상자를 닫을 때 상자가 닫힙니다. 지금 옆에 두 번째 상자가 있습니다. 선택기를 클릭하거나 전환 할 때만 닫힙니다. 나는 또한 이것을 클릭했을 때 닫을 수도 있습니다.

_closeSelectbox: function (target) { 
     var inst = this._getInst(target); 
     //if (!inst || !this._state[inst.uid]) { 
     if (!inst || !inst.isOpen) { 
      return; 
     } 
     var onClose = this._get(inst, 'onClose'); 
     inst.settings.effect === "fade" ? $("#catOptions_" + inst.uid).fadeOut(inst.settings.speed) : $("#catOptions_" + inst.uid).slideUp(inst.settings.speed); 
     $("#catToggle_" + inst.uid).removeClass(inst.settings.classToggleOpen); 
     this._state[inst.uid] = FALSE; 
     inst.isOpen = FALSE; 
     if (onClose) { 
      onClose.apply((inst.input ? inst.input[0] : null), [inst]); 
     } 
     $.data(target, PROP_NAME, inst); 
     }, 

다른 박스 기능하는 방식을 방해하지 않고 어떻게이게 가능 :

이 이미 코드는?

 <div class="col-sm-8 col-xs-12"> 
     <form class="form-inline form-header" action="<?php echo $this- >url(null, 'listings-search'); ?>" 
       method="get"> 
      <div class="form-group hidden-xs hidden-sm"> 
       <select name="parent_id" id="category_id"> 
        <option value="0"><?php echo $this->_('Choose Category'); ?></option> 
        <?php foreach ($categories as $category) { ?> 
         <option 
          value="<?php echo $category['id']; ?>" <?php echo ($category['id'] == $request->getParam('parent_id')) ? 'selected' : ''; ?>><?php echo $this->_($category['name']); ?></option> 
        <?php } ?> 
       </select> 
      </div> 
      <div class="form-group"> 
       <input id="basic-search" type="text" name="keywords" class="form-control input-search" 
         value="<?php echo $this->request()->getRequest()->getParam('keywords'); ?>" 
         placeholder="<?php echo $this->_('Search ...'); ?>" required> 
      </div> 
      <button type="submit" class="btn btn-primary hidden-xs"><?php echo $this->_('Search'); ?></button> 
     </form> 
     </div> 
+0

HTML은 어디에 있습니까? – Adjit

+0

내 게시물을 수정했습니다 ... – Stefanl

답변

0

내가 상자에 흐림 이벤트를 바인딩 권하고 싶습니다, 나는 그것이 정확히 당신이 필요로 할 것입니다 확신 해요 :

이는 HTML입니다! https://api.jquery.com/blur/

관련 문제