Hi everyone,I'm using bootstrap for my multi drop down menu,but it has a problem. i want to show sub menu when scroll bar on a sub menu
but it's not working for me,anyone can help me? please check my screenshot and my code,thank you very much.

Screenshot :

My code:

<!DOCTYPE html>
<meta charset="utf-8" />

<script type='text/javascript' src='http://code.jquery.com/jquery-2.0.2.js'></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script type='text/javascript' src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">

.dropdown-menu > li {
position: relative;
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;
cursor: pointer;

.dropdown-menu .sub-menu {
left: 100%;
position: absolute;
top: 0;
display: none;
margin-top: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left-color: #fff;
box-shadow: none;

.right-caret:after, .left-caret:after {
content: "";
border-bottom: 5px solid transparent;
border-top: 5px solid transparent;
display: inline-block;
height: 0;
vertical-align: middle;
width: 0;
margin-left: 5px;

.right-caret:after {
border-left: 5px solid #ffaf46;

.left-caret:after {
border-right: 5px solid #ffaf46;

.sub-menu {
height: 200px;
overflow-y: scroll;

<script type='text/javascript'>
$(function () {
$(".dropdown-menu > li > a.trigger").on("click", function (e) {
var current = $(this).next();
var grandparent = $(this).parent().parent();
if ($(this).hasClass('left-caret') || $(this).hasClass('right-caret'))
$(this).toggleClass('right-caret left-caret');
grandparent.find('.left-caret').not(this).toggleClass('right-caret left-caret');
$(".dropdown-menu > li > a:not(.trigger)").on("click", function () {
var root = $(this).closest('.dropdown');
root.find('.left-caret').toggleClass('right-caret left-caret');

<div class="dropdown" style="position:relative">
<a href="#" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Click Here <span class="caret"></span></a>
<ul class="dropdown-menu">
<a class="trigger right-caret">Level 1</a>
<ul class="dropdown-menu sub-menu">
<li><a href="#">Level 2</a></li>
<a class="trigger right-caret">Level 2</a>
<ul class="dropdown-menu sub-menu">
<li><a href="#">Level 3</a></li>
<li><a href="#">Level 3</a></li>
<a class="trigger right-caret">Level 3</a>
<ul class="dropdown-menu sub-menu">
<li><a href="#">Level 4</a></li>
<li><a href="#">Level 4</a></li>
<li><a href="#">Level 4</a></li>
<li><a href="#">Level 2</a></li>
<li><a href="#">Level 1</a></li>
<li><a href="#">Level 1</a></li>