Solved

Jquery fadein Blinking in IE8 browser due to Doctype

Posted on 2013-05-10
6
492 Views
Last Modified: 2013-05-15
I have a slide show that I have created using jquery's fadein/fadeout.
It works in all browsers except Internet Explorer 8

Problem: ( IE8 only )
The images are blinking instead of fading in and out

Work done:
I know it has to do with the Doctype, because if i remove it, the jquery works fine.
But then the CSS Styles will not work.

So if I have the Doctype - CSS works / Jquery does not
If I dont have the Doctype - Jquery works / CSS does not

I have tried all types of transitional/strict Doctypes, none of them works.

Anyone have a solution or simple Jquery Fadein/Fadeout for this?

All I am trying to do is have a simple .fadein/.fadeout of 4 images using Jquery.

Thanks in advance

<!DOCTYPE>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function(){
$('.fadein p:gt(0)').hide();setInterval(function(){$('.fadein > :first-child').fadeOut().next('p').fadeIn().end().appendTo('.fadein');}, 
<!--change speed-->
    1000
<!--change speed-->
);});
</script>

<style>
#page{margin:0 auto;padding:1%;width:90%;background:red;min-height:450px;}
#left{float:left;width:48%;background:blue;}
#right{float:right;width:48%;background:lime}
.fadein { position:relative;}
.fadein p { position:absolute;top:0;right:0;bottom:0;left:0;}
.fadein img {width:100%;max-height:350px;}
</style>

<p>top of webpage here</p>

<div id="page">
<div id="left">hello lefty</div>
<div id="right">
<div class="fadein">
<p><img src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg"></p>
<p><img src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg"></p>
<p><img src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">image3</p>
</div></div>
</div>


<p>bottom of page here</p>

Open in new window

0
Comment
Question by:webdott
  • 3
  • 3
6 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
If that is your actual web page, there are many things wrong with it.  Incomplete DOCTYPE, no <head> section, no <body> section.  This is what it should be at a very minimum for it to work predictably.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function(){
$('.fadein p:gt(0)').hide();setInterval(function(){$('.fadein > :first-child').fadeOut().next('p').fadeIn().end().appendTo('.fadein');}, 
<!--change speed-->
    1000
<!--change speed-->
);});
</script>

<style>
#page{margin:0 auto;padding:1%;width:90%;background:red;min-height:450px;}
#left{float:left;width:48%;background:blue;}
#right{float:right;width:48%;background:lime}
.fadein { position:relative;}
.fadein p { position:absolute;top:0;right:0;bottom:0;left:0;}
.fadein img {width:100%;max-height:350px;}
</style>
</head>
<body>
<p>top of webpage here</p>

<div id="page">
<div id="left">hello lefty</div>
<div id="right">
<div class="fadein">
<p><img src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg"></p>
<p><img src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg"></p>
<p><img src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">image3</p>
</div></div>
</div>

<p>bottom of page here</p>
</body>
</html>

Open in new window

0
 

Author Comment

by:webdott
Comment Utility
Thanks for that. I was showing the stripped down code.

Even with the complete code in, it does not work.
The CSS works, but the fadein jquery BLINKS instead of FADING

If I remove the <!DOCTYPE html>
the JQUERY FADEIN/OUT works
but the CSS does not work

The problem I am trying to solve is for them Both to work.

Thanks, but that does not fix the problem.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
I doubt that we can provide a solution with what you have shown us.  Can you give us a link to the page so we can check it out?

PS:  I just noticed you said Internet Explorer 8.  IE8 does not support the HTML5 DOCTYPE.  You will need to use an earlier DOCTYPE if that is important.  http://www.w3.org/QA/2002/04/valid-dtd-list.html
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Accepted Solution

by:
webdott earned 0 total points
Comment Utility
Thanks, but I fixed it.

I needed to get rid of the <p> and change my script and style to be <img> instead.
It was having issues with trying to style and run the <p> paragraph.

I could have changed it all to a <div> but why add more code.

here is the final code for anyone in the future:

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function(){
$('.fadein img:gt(0)').hide();setInterval(function(){$('.fadein > :first-child').fadeOut().next('img').fadeIn().end().appendTo('.fadein');}, 
<!--change speed-->
    1000
<!--change speed-->
);});
</script>


<style>
#page{margin:0 auto;padding:1%;width:90%;background:red;min-height:450px;}
#left{float:left;width:48%;background:blue;}
#right{float:right;width:48%;background:lime}
.fadein { position:relative;}
.fadein img {width:100%;max-height:350px;position:absolute;}
</style>
</head>
<body>
<p>top of webpage here</p>

<div id="page">
<div id="left">hello lefty</div>
<div id="right">
<div class="fadein">
<img src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg">
<img src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg">
<img src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">
</div></div>
</div>

<p>bottom of page here</p>
</body>
</html>

Open in new window

0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
Comment Utility
Cool then, glad you fixed it.
0
 

Author Closing Comment

by:webdott
Comment Utility
thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now