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
Solved

Jquery fadein Blinking in IE8 browser due to Doctype

Posted on 2013-05-10
6
498 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 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hide un-named HTML Label with CSS 14 36
Media Queries  not Firing 6 17
How to make button inactive until I fill in all the boxes. 11 18
Autocomplete with Jquery Question 2 19
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
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 embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

840 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