twitter bootstrap dropdown doesn't toggle closed when it should

后端 未结 8 1051
伪装坚强ぢ
伪装坚强ぢ 2021-02-10 00:16

Oh man, I\'ve been tearing my hair out over this. 4 hours on a dropdown.

I\'m using Twitter Bootstrap.

The fixed nav at the top has a dropdown, pretty standard s

8条回答
  •  一个人的身影
    2021-02-10 01:15

    This is the full solution I implemented based on merv's great answer. If there is a better way for me to post the solution for those coming in the future please let me know.

    This jquery was added to the bottom of the html of the pages in the frame:

    $('html').on('click', function () {
      parent.$('#frame').trigger('click');
    });
    

    The dropdown was switched to a button and restyled to fit into the navbar. In the html:

                    
  • Sample
  • In the CSS:

            #samplebtn {
            position:absolute;
            top: 0;
            margin: 0px;
            padding: 0px;
            border: 0px;
            }
            #samplebtn .btn {
                border: 0px;
            }
    

    full code of solution (update of the full code in the question - this is the outside frame only):

    
    
        
            
            test
            
            
            
            
            
        
        
            
            

    for complete reference, this is the code of a page inside the frame:

    
    
    
        
            
            Title
    
            
            
            
            
            
        
    
        
            
            
    
    
            

    Project Description

    Lorem Ipsum Dolor Sit Amet

    Fixed testing site you can preview at (but don't copy the whole page code, as it has some server side (cloudflare) stuff in it). http://www.joshlevent.com/dropdownbug/

提交回复
热议问题