Simple JQuery slider Script malfunction
Cant seem to pinpoint the error... This malfunctions if we click on the links out of order. Also the same page gets loaded over and over again when it malfunctions... (x1 even when x2 is clicked... look at html)
The jq -1.4.4min and jq tools min are also called
Here is the script...
$(function() {
$("#contentHolder").scrollable({ }).navigator({
navi: "div#mainMenu ul",
naviItem: 'a',
activeClass: 'current',
history: true
});
$('div#mainMenu ul a').click(function(){
var $this = this;
if(!$(this).hasClass('current')) {
i开发者_StackOverflowf(!$(this).data('clicked')){
if($(this).data('target')){
$.ajax({
url: $(this).data('target'),
success: function(data){
var index = $("div#mainMenu ul a").index($this);
$('#contentHolder .item').eq(index).html(data);
}
});
}
$(this).data('clicked',true)
}
}
$(this).blur();
return false;
});
$('div#mainMenu ul a').eq(0).click();
$('.input').focus(function(){
$(this).data('placeholder',$(this).val()).val('');
}).blur(function(){
if($(this).val()=='') {
$(this).val($(this).data('placeholder'));
}
});
$('#logo').click(function(){$('div#mainMenu ul a').eq(0).click(); return false;})
});
html...
<div id="mainMenu">
<ul>
<li><a class="navitem" href="#home" data-target="pages/x1.html"></a></li>
<li><a class="navitem" href="#products" data-target="pages/x2.html"> <h2>xxx</h2>
<p>xxxxx</p></a></li>
Maybe because you using an onclick and onfocus on the same div ?
精彩评论