Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:20:49+00:00 2026-06-10T06:20:49+00:00

var j$ = jQuery.noConflict(); j$(document).ready(function(){ j$.fn.slideShow = function(timeOut){ var $slidecontainer = this; this.children(‘:gt(0)’).hide(); setInterval(function()

  • 0

var j$ = jQuery.noConflict();

j$(document).ready(function(){

j$.fn.slideShow = function(timeOut){

var $slidecontainer = this;
this.children(':gt(0)').hide();

setInterval(function() {

$slidecontainer.children().eq(0).fadeOut(2000).next().fadeIn(2000).addClass('on').nextAll().removeClass('on').end().appendTo($slidecontainer);}, timeOut || 1000);

var imgheight = this.children('.on').outerHeight();
this.css('height', imgheight );
};


j$(function() {
j$('.slideshow').slideShow(7000);});
});

For the most part the above script works well. The only problem is the css for image height isn’t being applied to the parent container. When I try this in the browser console it works perfectly. When I have the script called in the page it doesn’t apply the image height. It does everything else though.

this is the html

<div id="slideshow" class="slideshow">
<img width="970" height="300" src="someimage.jpg" class="" >
<img width="970" height="300" src="someimage.jpg" class="" >
<img width="970" height="300" src="someimage.jpg" class="" >
<img width="970" height="300" src="someimage.jpg" class="" >
<img width="970" height="300" src="someimage.jpg" class="" >
</div>

The following turned out to be the answer:

var j$ = jQuery.noConflict();
j$.fn.slideShow = function (timeOut) {

    var $slidecontainer = this;
    $slidecontainer.children(':gt(0)').hide();

    setInterval(function () {

        $slidecontainer.children().eq(0).fadeOut(2000).next().fadeIn(2000).addClass('on').nextAll().removeClass('on').end().end().appendTo($slidecontainer);
    }, timeOut || 1000);

    var imgheight =  $slidecontainer.children('img').first().outerHeight();   
     $slidecontainer.css('height', imgheight);
};
j$(window).load(function () {
   j$('.slideshow').slideShow(7000);
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:20:51+00:00Added an answer on June 10, 2026 at 6:20 am

    Try,

    <div id="slideshow" class="slideshow">
           <img width="970" height="300" src="s_logo_lg.gif" class="" >
           <img width="970" height="300" src="lg.gif" class="" >
           <img width="970" height="300" src="es_logo_lg.gif" class="" >
           <img width="970" height="300" src="g.gif" class="" >
           <img width="970" height="300" src="http://www.google.co.in/intl/en_ALL/images/logos/images_logo_lg.gif" class="" >
     </div>
    

    var j$ = jQuery.noConflict();
    j$.fn.slideShow = function (timeOut) {
    
        var $slidecontainer = this;
        this.children(':gt(0)').hide();
    
        setInterval(function () {
    
            $slidecontainer.children().eq(0).fadeOut(2000).next().fadeIn(2000).addClass('on').nextAll().removeClass('on').end().end().appendTo($slidecontainer);
        }, timeOut || 1000);
    
        var imgheight = this.children('img').first().outerHeight();   
        this.css('height', imgheight);
    };
    j$(window).load(function () {
    
        j$(function () {
            j$('.slideshow').slideShow(7000);
        });
    });
    

    http://jsfiddle.net/RTZK6/

    $(window).load ensures that images are loaded, so that their hieght calcualtion goes fine in all browsers. You can specifically look for each img element also.

    Looks like you missed one end(), you selected next() and then nextAl() so you will need two end() to point selection back to current element.

    Updated fiddle

    http://jsfiddle.net/RTZK6/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<script type=text/javascript> var $j = jQuery.noConflict(); $j(document).ready( function(){ //is this right syntax for jquery
my code is var jQuery = jQuery.noConflict(); $(document).ready(function() { var $filterType = $('#filterOptions li.active
I am using the following cookie: var $j = jQuery.noConflict(); $j(document).ready(function(){ if (document.cookie.indexOf('visited=true') ==
i have a slider whose code is var jq = jQuery.noConflict(); jq(document).ready(function(){ jq(a.zootoggle).click(function ()
JavaScript/JQuery var arr=[]; $('.element').each(function(i) { arr.push({id:i,value:$(this).attr('data-value')}); }); $.get('/json.php?arr='+arr,function(result) { alert(result); }); PHP <?php $j
I made this bookmarklet: javascript:(function(){var s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);$('#hldIntMain').hide();$('#fadeBackground').hide();return false;})() Formatted code: // Add in jQuery var
I have a jquery mouseover event which succesfully calls a javascript function $(document).ready(function() {
I have the following in my (document).ready function: replace_fav_url(); and the jQuery function: function
I have two pages with a script jQuery(document).ready(function() { jQuery(#+id).simpletip({ /*content: 'A simple tooltip2
Here's my jQuery: var docname = $('#doc').val(); function parseXml(xml) { $(xml).find(rsp).each(function() { alert(success); });

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.