Title: Problem with &#8216;Keep highlight until next&#8217;
Last modified: September 27, 2016

---

# Problem with ‘Keep highlight until next’

 *  Resolved [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * (@rbmunik)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/)
 * Hello Malihu,
 * Thanks a lot for your great plugin, really enjoying it so far.
    However I’ve 
   run into a little problem as I’m using the option ‘Keep highlight until next’
   to highlight my menu, but I’d like for the menu items to highlight once that 
   section is at the top of the page and not once it has come into view as it does
   now. Is there any way to fix this?
 * Thanks a lot!

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8225530)
 * Hello and thanks for your comments!
 * There’s no way to change at which position (relative to viewport) the links get
   the highlight classes (at least for now).
 * Maybe you can do what you want by using the `.mPS2id-highlight-first` or `.mPS2id-
   highlight-last` classes instead of the general `.mPS2id-highlight` in your CSS(?)
 *  Thread Starter [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * (@rbmunik)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8225700)
 * Alright I’ll try that, thanks for the help!
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8225750)
 * No problem 🙂
 *  Thread Starter [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * (@rbmunik)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8262612)
 * Hello Malihu, I fixed my problem partially by taking the div with the ID and 
   taking it further down the page using position:relative and -100vh, now the menu
   is behaving like I want to.
    I thought I could set the scroll position back using
   the offset option, however I can only but pixels in here.
 * Is there any way I could input a scoll offset of vh or %?
 * Thanks for the help!
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8266190)
 * Offset option accepts either a fixed pixel value or an element selector (to calculate
   its height). If you have an element in your HTML that has the same height as 
   the viewport height (e.g. some div, the body etc.) you can set it as the offset
   value.
 * If you don’t have such element, you’d have to add an extra js script in your 
   theme/template to change plugin’s offset dynamically. Check if your theme provides
   a way to enter some custom javascript or place the following in your footer.php
   right before the closing body tag:
 *     ```
       <script>
       (function($){
         $(window).on("load resize",function(){
           $(document).data("mPS2id").offset=Math.max(document.documentElement.clientHeight,window.innerHeight || 0);
         });
       })(jQuery);
       </script>
       ```
   
    -  This reply was modified 9 years, 8 months ago by [malihu](https://wordpress.org/support/users/malihu/).
 *  Thread Starter [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * (@rbmunik)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8268329)
 * Thanks for all the help, everything is working exactly like I want now.
    I dont
   have much cash to spare but I made a small donation for your troubles via your
   website.
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8268362)
 * Awesome, glad it worked as you wanted!
    Thanks **a lot** for the donation. I 
   really appreciate it and any amount is more than enough 🙂
 *  Thread Starter [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * (@rbmunik)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8330886)
 * Hello again Malihu,
 * I was hoping you could help me out 1 last time;
    I’m almost done with the site,
   but sometimes when you click a menuitem it seems it when you arrive there it’s
   1 pixel off it’s destination so the menu item doesn’t light up. Here’s the website
   I’m working on: [http://www.pietereliens.com/](http://www.pietereliens.com/)
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8334920)
 * You could try adjusting the offset like:
 *     ```
       $(document).data("mPS2id").offset=Math.max(document.documentElement.clientHeight,window.innerHeight || 0)-2;
       ```
   
 * and subtract (or add) the pixels amount you want at the end.
    -  This reply was modified 9 years, 7 months ago by [malihu](https://wordpress.org/support/users/malihu/).
    -  This reply was modified 9 years, 7 months ago by [malihu](https://wordpress.org/support/users/malihu/).
 *  Thread Starter [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * (@rbmunik)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8337941)
 * Thanks a bunch!!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Problem with ‘Keep highlight until next’’ is closed to new replies.

 * ![](https://ps.w.org/page-scroll-to-id/assets/icon-256x256.png?rev=1401043)
 * [Page scroll to id](https://wordpress.org/plugins/page-scroll-to-id/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/page-scroll-to-id/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/page-scroll-to-id/)
 * [Active Topics](https://wordpress.org/support/plugin/page-scroll-to-id/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/page-scroll-to-id/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/page-scroll-to-id/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [rbmunik](https://wordpress.org/support/users/rbmunik/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/problem-with-keep-highlight-until-next/#post-8337941)
 * Status: resolved