jQuery script fails in IE and Opera
http://dev.mindboiler.lv/ (you'll be taken to intro page, just click on logo to get into real site)
This is website I'm cu开发者_如何转开发rrently working on. You can change the language to English to understand it a little better, but anyways, it's full of dummy text.
There are theseRead more
links which, when clicked, execute the following jQuery:
$('.content-item .readmore').toggle(function() {
parent = $(this).parent();
$(parent).children('div.next').fadeIn();
$(this).html("Read less »");
}, function() {
parent = $(this).parent();
$(parent).children('div.next').fadeOut();
$(this).html("Read more »");
});
Firefox, Safari, Chrome works like a charm, but Internet Explorer (all versions) and Opera doesn't want to execute it properly.
Any solutions for this to work in IE and Opera?
P.S. Not a JavaScript/jQuery guru, therefore the script looks like crap.
Thanks in advance!
It appears as though your <div class="next">
is a sibling to your <div class="content-item">
so why even bother with the parent() function.
Simplify it to this and see if it works:
$('.content-item .readmore').toggle(function() {
$(this).next().fadeIn();
$(this).html("Read less »");
}, function() {
$(this).next().fadeOut();
$(this).html("Read more »");
});
精彩评论