2 Replies - 3738 Views - Last Post: 28 February 2009 - 04:38 AM

#1 skater_00   User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 257
  • Joined: 30-April 08

jQuery: positioning a div with float

Post icon  Posted 19 February 2009 - 02:19 PM

Assignment said:

- Add a new div with id promotiediv and put it next to the 2 other columns using float. To do this correctly, you need to calculate the available width in the container. Do this dynamically! This means that when you adjust values in the CSS file, your code won't fall apart. Use the correct methods to determine the width and don't forget about the margins!!!!
- The new div contains an h3 with text 'promoties' and also a list where the elements are taken from an array. The initial values of this array are: 'Moestuinartikelen', 'Harken', 'Gras zaadjes', 'Veel meer...'. The list type is unordered.


Here's what I made of it so far:
$(document).ready(function() {
	$("#container").append($("<div>").attr("id", "promotiediv").append($("<h3>").text("promoties")).append($("<ul>")));
	var array = new Array("Moestuinartikelen", "Harken", "Gras zaadjes", "Veel meer...");

	for (var i = 0; i < array.length; i++) {
		$("#promotiediv ul").append($("<li>").text(array[i]));
	}
});


I'm having trouble positioning this new div. I think I may have to use css("float", "right") to put it next to the 2 other columns, but then it's still located at the bottom of the page. I'm stuck! How can I successfully finish this assignment?

EDIT: You can download my source files here: Attached File  Greeny_Grass.zip (228.98K)
Number of downloads: 291

This post has been edited by skater_00: 20 February 2009 - 10:08 AM


Is This A Good Question/Topic? 0
  • +

Replies To: jQuery: positioning a div with float

#2 skater_00   User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 257
  • Joined: 30-April 08

Re: jQuery: positioning a div with float

Posted 22 February 2009 - 10:53 PM

Nobody? :(
Was This Post Helpful? 0
  • +
  • -

#3 skater_00   User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 257
  • Joined: 30-April 08

Re: jQuery: positioning a div with float

Posted 28 February 2009 - 04:38 AM

Thanks for the help! I solved it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1