html - Jquery Place item dynamically -


is there way place element next item.

this code . setting button item dynamically this

var button_text = "learn now"; $("#ctabtn").text(button_text); $("#ctabtn").css('width', parsefloat(textwidth(button_text) + 30) + "px"); 

which fine want logo next button adjust position dynamically. if change button text to

var button_text = "learn more !!!"; 

then size of button increases , logo position not moved right. how can move logo dynamically based on button text size?

remove left position #image_logo img , set right position instead jquery. this:

$("#image_logo img").css("right", $("#ctabtn").width() + 60); 

instead of 60 can use value better you. now, when dynamically change text in button, logo moves left it.

check code on jsfiddle.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -