Home › Forums › JavaScript › Menu problems
- This topic is empty.
-
AuthorPosts
-
August 30, 2013 at 9:36 am #148610CarraraWebsiteSolutionsParticipant
hello I have new menu just making.
But my javascript does not pick up the new menu that have made.
can figure out how to change it so can pick up the columns.
$('#menu ul > li > a + div').each(function(index, element) { // IE6 & IE7 Fixes if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 6)) { var category = $(element).find('a'); var columns = $(element).find('ul').length; $(element).css('width', (columns * 143) + 'px'); $(element).find('ul').css('float', 'left'); } var menu = $('#menu').offset(); var dropdown = $(this).parent().offset(); i = (dropdown.left + $(this).outerWidth()) - (menu.left + $('#menu').outerWidth()); if (i > 0) { $(this).css('margin-left', '-' + (i + 5) + 'px'); } }); <?php if ($categories) { ?> <div class="container"> <div class="row"> <nav class="navbar navbar-default" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-categories"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse nav-categories"> <ul class="nav navbar-nav"> <?php foreach ($categories as $category) { ?> <?php if ($category['children']) { ?> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?><span class="caret"></span></a> <ul class="dropdown-menu"> <?php for ($i = 0; $i < count($category['children']);$i++) { ?> <?php if (isset($category['children'][$i])) { ?> <li> <a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a> </li> <?php } ?> <?php } ?> </ul> </li> <?php }else{ ?> <li> <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> </li> <?php } ?> <?php } ?> </ul> </div><!-- /.navbar-collapse --> </nav> </div> </div> <?php } ?>
September 3, 2013 at 3:26 am #148873ChromawoodsParticipantWhere is that JS located, I assume it is not just floating above the HTML like that? Is it even inside a
<script>
tag? Included somewhere? When is the JS executed, could it be executing before the HTML exists?September 3, 2013 at 7:23 am #148907CarraraWebsiteSolutionsParticipantno js is is in different location I am having now my programmer look at it.
September 3, 2013 at 8:50 am #148926EdParticipantIt looks like the problem might be an overly specific jQuery selector that’s missing your elements.
See if it works if you remove
+ div
from the selector. If that doesn’t fix it, try changing it to#menu ul li
.It would be good if you could provide us with an example (a live page that demonstrates the problem) so we can debug it and fix it for you!
September 5, 2013 at 1:23 am #149118CarraraWebsiteSolutionsParticipantI am just working on new one now. just also got beta version of this store I have working on it now
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.