Reputation: 53
In my body
tag of the page i have a div that contains multiple images (each img has an id of movie, so like movie1, movie2, and so on) that will have a slide show effect. I don't know why this isn't working but instead of having to give each individual img the css
tag of max-width: 100%; max-height: 100%
to fit the div correctly in my jQuery
i put $('img[id^=movie).css('max-width', '100%', 'max-height', '100%'
, but this isn't working. This code should see that any img that has the word movie in it (all of them do) should have these max tags for it so it can fit the div. Why isn't this working?
Upvotes: 0
Views: 76
Reputation: 21
You are using the .css( propertyName, value )
syntax for setting mutliple css properties.This can be used only for setting value to a single css property
To set multiple css properties, you should pass an object of property-value pairs of css properties.
$('img[id^=movie]').css({'max-width': '100%', 'max-height':'100%'})
source:http://api.jquery.com/css/
Upvotes: 2