Solved

Jquery fadein Blinking in IE8 browser due to Doctype

Posted on 2013-05-10
6
507 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39156907
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
ID: 39156936
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 83

Expert Comment

by:Dave Baldwin
ID: 39157062
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
webdott earned 0 total points
ID: 39157179
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 83

Assisted Solution

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

Author Closing Comment

by:webdott
ID: 39167428
thanks
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

691 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