Repositioning JQuery Autocomplete Results

I am currently integrating JQuery Autocomplete into my website, but I am encountering an issue with displaying the search results in the search form. The search form is placed within a Bootstrap 3 navbar on the main layout of the site.

 Embedded inside the navbar

 <div class="col-sm-3 col-md-3" id="search">
    <form class="navbar-form" role="search" action ="{{ path('search')}}" method ="get">
       <div class="input-group">
          <input type="text" class="form-control" placeholder="Search city/town" name="query" value="{{ app.request.get('query') }}" id="search_keywords">
       <div class="input-group-btn">
          <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>

        </div>
      </div>
   </form>
</div>

js

<script>
    $(function() {
        function log( message ) {
            $( "#log" ).scrollTop( 0 );
        }
        $( "#search_keywords").autocomplete({
            source: "{{ path('city_autocomplete') }}",
            minLength: 2,
            messages: {
                noResults: '',
                results: function() {}
            },
            select: function( event, ui ) {
            log( ui.item ?
                "Selected: " + ui.item.value + " aka " + ui.item.label:
                "Nothing selected, input was " + this.value );
                $("#search_keywords").val(ui.item.label);
                $("#search_keywords").val(ui.item.value);
                return false;
            },
            change: function( event, ui ) {
                $( "#search_keywords" ).val( ui.item? ui.item.value : 0 );
            } 
        });
    });
</script>

I need to create a 'gap' between the search form and the displayed results as some of the results are being partially hidden by the search form.

https://i.sstatic.net/e5hzR.png

In the JQuery script, I tried adding

position: { my : "bottom+3" },

However, this solution did not work for me. In terms of CSS, I have mainly utilized Bootstrap's CDN for styling, and do not have any custom CSS specifically for this search form. Any suggestions or ideas on how to address this issue?

Answer №1

Successfully resolved the issue

.ui-autocomplete {
padding-top: 20px !important;
position: absolute !important;

}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it Class Design Sheet with double names?

<div id="SideBar" class="sidebar mainbar"> Recently, I came across this code snippet in a .aspx file. Is this code valid? Can anyone guide me on understanding its functionality? I assume it is valid, but I am unable to locate it in the CSS file. Whi ...

The issue with NGX-Bootstrap/Angular Pagination arises when attempting to adjust the maxSize input while the screen view (width) is being altered

Currently, I am utilizing the Pagination component from Valor Software (click here to access). I am interested in adjusting the maxSize input dynamically based on changes in screen width. For reference, please see this example: Click to view example. It ...

What is the best way to ensure your background image appears proportional?

I'm having an issue with the background image on my login page - it doesn't look like the original photo: Take a look at the screenshot to see the problem with the width of the image: https://i.sstatic.net/qb9u0.jpg Here's the HTML/jsx cod ...

How much does it typically cost to implement external libraries into a project?

Here are some of the most commonly used front-end web development libraries: jquery-min.js (95.9 kB) angular.min.js (108.0 kB) bootstrap.min.css (113.5 kB) bootstrap-theme.min.css (19.8 kB) bootstrap-fonts (185.7 kB) bootstrap.min.js (35.6 kB) All in al ...

How can I apply Ben Alman's debounce jQuery function in my code?

I am currently utilizing a project found at https://github.com/cowboy/jquery-throttle-debounce My code seems to be somewhat functional, however the debounce feature is not functioning as expected. This results in the waterfall function being triggered for ...

What is the best way to center a div horizontally when the width is unknown?

Check out the full screen result here: http://jsfiddle.net/anik786/UYkSf/4/embedded/result/ Here's where you can find the HTML/CSS: http://jsfiddle.net/anik786/UYkSf/4/ This is the HTML code: <div class="gallery_container"> <div class="pic ...

Switching between two elements by reassigning a click event in a basic Jquery quiz

Currently, I'm facing a bit of a challenge with my project; As someone who is new to the world of Jquery and Javascript, I believe there must be a more efficient way to accomplish what I'm trying to do. However, for now, this is the approach I h ...

Swapping text occurrences individually with JavaScript

Seeking a way to dynamically replace multiple placeholder texts through JavaScript. Attempted using jquery filter and contain selector without much success. Any suggestions on how to achieve this? <div class="container"> <h1>$$Insert text here ...

Expand the <div> by clicking on it, then hover away to return it to its normal size

One interesting feature I have on my website is a <div> that expands when clicked, and returns to normal size with another click. However, I am looking for something a bit different... What I want is for the <div> (with the class name .topHead ...

Adjust the font sizes in Bootstrap4 to be in proportion with the Scss $font-size-base

I am currently customizing Bootstrap4 and facing challenges in understanding why certain elements are not functioning as anticipated. When modifying the original _variables.scss file by adjusting the $font-size-base, ideally, it should reflect across rela ...

PHP data is not displayed by Ajax

I seem to be encountering a bit of trouble. I am attempting to utilize ajax to retrieve data from a PHP server, which in turn fetches it from a MySQL database, and then display it within a specific HTML tag location. However, for some unknown reason, nothi ...

Cycle through the list and populate the table with the data

My attempt to clarify this explanation is my best, as articulating exactly what I am trying to achieve is quite challenging: Initially, I have a list of names: { "Items": [ { "Id": 0, "Name": "Robinson" }, ...

What could be the reason for my jQuery files not being loaded?

I have included jQuery and Bootstrap in my header as follows: <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" href="https://maxcdn.b ...

Differences between Ajax and GET requests in jQuery

Similar Question: jQuery ajax() vs get()/post() Can someone help me understand the variances between jQuery ajax() and jQuery get()? Furthermore, which method would be more appropriate for loading data from a URL into a div after a user clicks on a l ...

Other options to consider besides using flex wrapping

Is it possible to use other methods to wrap these image items with the display: flex; property besides using the flex-wrap property? Are there alternative approaches available? body { margin: 0px; } img {} h1 {} p {} a { background-color: #ddd; ...

Mobile-style menu with full desktop height

I am currently working on developing my first custom WordPress theme from scratch. My goal is to design a mobile-style menu that can also be displayed on desktop screens. To achieve this, I have used jQuery to implement the sliding effect. You can view a ...

What is the best way to align the form labels alongside and right justified with the form elements?

Could someone please help me with aligning my labels to be inline and right-justified against form elements? Currently, I'm facing this issue: this section { display: flex; flex-direction: row; justify-content: center; width: 960px; ...

Steps to display the "col-md-6" div upon hovering over list items in a different div

I have been trying to make a hover action work in my HTML document. I've managed to get it to work only when the description is a child of the li tag, but I want the description to be displayed as a separate div. <div class="row"> ...

Unexpected behavior observed with Bootstrap popover

<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Bootstrap Popover</title&g ...

Enhanced Bootstrap 4 button featuring custom design with text and image aligned on the right side, optimized for flexbox layout

I am looking to design a button-like div that features a flag image alongside the abbreviation of a country. Although I have some code in mind, it doesn't follow Bootstrap's guidelines and I am struggling to adapt it accordingly. <div cla ...