Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set position fixed of Div having(search button) during search functionality
    primarykey
    data
    text
    <p>I am doing search functionality .Search functionality is working fine.Problem is that when I start search It hide my Buttons(search , next , Previous).I will explain more.</p> <ol> <li>search for word "Sachin"</li> <li>Then press search it show sachin on same page But when you again click search /next it goes to next text But Buttons previous/next/search hide(go above).I need to show this button the page while searching.I thing I need to add fixed height where div contend scroll?</li> <li>This is problem Because if user click Third time it goes above then click search then search item goes down .Then again it goes up .It look so awe word.</li> </ol> <p>I need to fixed these Buttons on page while searching.</p> <p><a href="http://jsfiddle.net/ravi1989/3xbGW/" rel="nofollow">http://jsfiddle.net/ravi1989/3xbGW/</a></p> <pre><code>var searchIndex = -1; var searchTermOld =''; $(document).ready(function(){ $('.searchbox').on('change',function(){ if($(this).val()===''){ var selector= "#realTimeContents"; $(selector+' span.match').each(function(){ $(this).replaceWith($(this).html()); }); } searchIndex = -1; $('.searchNext').attr("disabled", "disabled"); $('.searchPrev').attr("disabled", "disabled"); searchTermOld = $(this).val(); }); $('.searchbox').on('keyup',function(){ var selector= "#realTimeContents"; if($(this).val()===''){ $(selector+' span.match').each(function(){ $(this).replaceWith($(this).html()); }); } if($(this).val() !== searchTermOld){ $(selector+' span.match').each(function(){ $(this).replaceWith($(this).html()); }); searchIndex = -1; $('.searchNext').attr("disabled", "disabled"); $('.searchPrev').attr("disabled", "disabled"); } }); $('.search').on('click',function(){ if(searchIndex == -1){ var searchTerm = $('.searchbox').val(); if(searchTerm==''){ alert("Please Insert Text.") return ; } searchAndHighlight(searchTerm); } else searchNext(); if($('.match').length &gt;1){ $('.searchNext').removeAttr("disabled"); $('.searchPrev').removeAttr("disabled"); } }); $('.searchNext').on('click',searchNext); $('.searchPrev').on('click',searchPrev); }); function searchAndHighlight(searchTerm) { if (searchTerm) { var searchTermRegEx, matches; var selector= "#realTimeContents"; $(selector+' span.match').each(function(){ $(this).replaceWith($(this).html()); }); try { searchTermRegEx = new RegExp('('+searchTerm+')', "ig"); } catch (e) { return false; } $('.highlighted').removeClass('highlighted'); matches = $(selector).text().match(searchTermRegEx); if (matches !==null &amp;&amp; matches.length &gt; 0) { var txt = $(selector).text().replace(searchTermRegEx, '&lt;span class="match"&gt;$1&lt;/span&gt;'); $(selector).html(txt); searchIndex++; $('.match:first').addClass('highlighted'); if($('.match').eq(searchIndex).offset().top &gt; $(window).height()-10){ $(document).scrollTop($('.match').eq(searchIndex).offset().top); } return true; }else{ alert('Search not found.'); } return false; } return false; } function searchNext(){ searchIndex++; if (searchIndex &gt;= $('.match').length) searchIndex = 0; $('.highlighted').removeClass('highlighted'); $('.match').eq(searchIndex).addClass('highlighted'); if($('.match').eq(searchIndex).offset().top &gt; $(window).height()-10){ $(document).scrollTop($('.match').eq(searchIndex).offset().top); } } function searchPrev(){ searchIndex--; if (searchIndex &lt; 0) searchIndex = $('.match').length - 1; $('.highlighted').removeClass('highlighted'); $('.match').eq(searchIndex).addClass('highlighted'); if($('.match').eq(searchIndex).offset().top &gt; $(window).height()-10){ $(document).scrollTop($('.match').eq(searchIndex).offset().top); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload