How to Jump Quickly Across Strings
When playing in positionThe position is the fret which the index finger is assigned to. The next three fingers are assigned to the next three frets. The index finger stretches if necessary to reach to notes in lower positions, and the index finger can stretch higher to reach notes above the position., it is often necessary to switch between two notes that are on the same fret of two different strings.
See It In Action

This lick uses a simple major scale to make the demonstration. Most of the notes of the scale can be played with the ordinary techniques. But at the highlighted point, the note switches from fret X of the 5th string to fret X of the 6th string, and then it comes back.
Here is an opportunity to use a small trick to play this part of the passage with greater ease and efficiency.
There are two variations, depending on the effect needed.
Method 1
The simplest method is to actually barre the two notes at once, together, and then play them with the pick. Bingo—three notes for the price of one! That is, in one motion we've set up the three highlighted notes, and then played them with the right hand.
Although this works, it does tend to allow the two strings to ring together, an effect that may not be desired in the melody.
Method 2
Another method for executing this move is to play the first note with the standard technique, then play the second note by quickly laying that same finger flat over it, jumping up straight again to play the third note.
This technique sounds as if you played the three notes with different fingers, but is faster and smoother.
Master the Technique with Pentatonic SCales
Playing any of the pentatonic scale patterns in a series of fourths will result in many such leaps from one string to the next on the identical fret, and thus presents an excellent chance to practice this technique further.
To master this technique, practice playing sequences of fourths using pentatonic scales.
Scale Diagram
Notation

Coda
One example of the pentatonic scale is given here, but for true mastery, this picking pattern should be applied to all five pentatonic patterns.
