run submenu code only when #topmenu is present

todo update
This commit is contained in:
Crack
2010-07-25 22:58:52 +02:00
parent b39567f381
commit 8d24baad94
2 changed files with 13 additions and 2 deletions

View File

@@ -1795,6 +1795,10 @@ function menuResize()
}
$(function() {
var topmenu = $('#topmenu');
if (topmenu.length == 0) {
return;
}
// create submenu container
var link = $('<a />')
.attr({href: '#', 'class': 'tab'})
@@ -1802,7 +1806,7 @@ $(function() {
.click(function(e) {
e.preventDefault();
});
var img = $('#topmenucontainer li:first-child').find('img');
var img = topmenu.find('li:first-child').find('img');
if (img.length) {
img = img.clone();
img.attr('src', img.attr('src').replace(/\/[^\/]+$/, '/b_more.png')).prependTo(link);
@@ -1822,7 +1826,7 @@ $(function() {
}
})
.hide();
$('#topmenu').append(submenu);
topmenu.append(submenu);
// populate submenu and register resize event
$(window).resize(menuResize);