I have to implement a slider that will show 4 publish pictures from the particular category in every slide. With this I authored this:

<ul class= "videoSlider">
                            <?php
                            $pStart = 0;
                            $flag = true;

                            while ($flag) {

                                query_posts('cat=14&posts_per_page=4&offset='.$pStart);

                                $pStart = + 4;
                            ?>


                                <li>
                                <?php
                                if (have_posts ()) {

                                    while (have_posts ()) {
                                        the_post();
                                ?>
                                        <div onclick="something()">

                                    <?php echo the_post_thumbnail(array(215, 190)); ?>
                                         </div>

                                <?php
                                    }
                                } else {
                                    $flag = false;
                                }
                                ?>
                            </li>


                            <?php

                            wp_reset_query();

                            } ?>

The dwelling I demand for jquery slider is one thing such as this:

                <ui>
                      <li>
                        <div>
                            thumb 1
                        </div>
                        <div>
                           thumb 2
                        </div>
                        <div>
                            thumb 3
                        </div>
                        <div>
                            thumb 4
                        </div>
                    </li>


                    <li>
                        <div>
                            thumb 5
                        </div>
                        <div>
                           thumb 6
                        </div>
                        <div>
                            thumb 7
                        </div>
                        <div>
                            thumb 8
                        </div>
                    </li>

                </ul>

But code isn't working for whatever reason! Appears like after producing couple of lists the code execution doesn't stop and browser dangles. Have I made use of the function inside a wrong way: 'query_posts('cat=14&posts_per_page=4&offset='.$pStart)' ? How must i really implement it?

If you have plenty of posts, that outer while loop will continue going until it's queried every publish, 2 at any given time!

Appears in my experience like you are making things complicated on your own, so this is what I'd do rather

global $wp_query;
query_posts('cat=14');

if ( have_posts() ):

    $last_post = $wp_query->post_count - 1; // index for the last post
    $counter = 0;

    echo '<ul class= "videoSlider">';

        while ( have_posts() ):

            the_post();

            if ($counter === 0)
                echo '<li>';

            echo '<div onclick="something()">';
            the_post_thumbnail(array(215, 190));
            echo '</div>';

            if ($counter === 3 || $last_post == $wp_query->current_post) {
                $counter = 0;
                echo '</li>'; // close the tag every 4th item, or if we're at the end of the loop

            } else {
                $counter++;
            }


        endwhile;

    echo '</ul>';

endif;