jquery - Javascript image slider sends text off screen and brings footer up -


i have javascript slider located on page at: crothersenvironmental.com/crothers/index.html keeps sending associated paragraph text under off side of screen. can see under slider down right. once click associated numbers above slider you'll see text move right every time numbers clicked until moved off screen , disappear. also, once click #1 footer comes way , moves down after click of other numbers.

any help, thoughts or direction helpful. in advance.

here js script using:

$('#recentprojects li a').click(function() {

var $this = $(this);  if ( !$this.parent('li').hasclass('selected') ) {      var url = this.href,         height = $('#recentworkimage img').css('height');      $this       .parents('ol')       .find('li.selected')         .removeclass('selected');      $this.parent('li').addclass('selected');      $('#recentworkimage')       .css('height', height)       .children('img')         .fadeout(1000, function() {             $(this).attr('src', url).load(function() {                 $(this).fadein(1000);             });          $this.parents('#recentprojects')           .find('p:last')             .empty()             .html('<p>' + $this.attr('title') + '</p>');     });  }  return false; 

});

first of all, not need empty element before setting new html string, .html() replaces whole contents. reason subtitle moving more , more right, because you're adding <p> elements recursively.

try following:

$this.parents('#recentprojects')     .find('p:last')     .html($this.attr('title')); 

although in case (as ar looking unique id) simplify so:

$('#recentprojects')     .find('p:last')     .html($this.attr('title')); 

or if <p> have within element, can reduce further:

$('#recentprojects p')     .html($this.attr('title')); 

if want update subtitle javascript when page loads, add following:

$(document).ready(function () {     var projects = $('#recentprojects');     projects         .find('p:last')         .html(projects             .find('a:first')             .attr('title')); }); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -