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

  • SEARCH
  • Home
  • 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 8113085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:42:54+00:00 2026-06-06T02:42:54+00:00

Q1) On page load is it possible with Jquery to check the file name

  • 0

Q1) On page load is it possible with Jquery to check the file name of the image and then set the css to position it on the page?

Q2) What is the easiest way to manage this, the user will not be embedding the iframe code inside the div.icon

I have a play button icon which will be in the product description in an ecommerce website. When the user clicks play it will show the youtube video exactly inside the product-image div box. The icon will be positioned next to the image nav icons so the user has an option to see the video while browsing the pics.

It seems to work nice here is my code:

HTML:

<div class="container">
    <div class="product-image"><img src=
    "http://www.skriftlig.com/konfliktmegling/wp-content/uploads/2010/02/Photoxpress_2658886-480x220.jpg"
    alt=
    "http://www.skriftlig.com/konfliktmegling/wp-content/uploads/2010/02/Photoxpress_2658886-480x220.jpg" /></div>

    <div class="image-nav"></div>

    <div class="icon">
      <iframe width="480" height="220" src=
      "http://www.youtube-nocookie.com/embed/jvTv_oatLA0?rel=0" frameborder="0"
      allowfullscreen=""></iframe>
    </div>
  </div>

CSS:

div.container
{
    margin:10px 10px auto;
    border:1px solid orange;
}

div.product-image
{
    height:220px;
    width:480px;
    border:1px solid red;
    margin:30px;      
}

div.image-nav
{
    border:1px solid black;
    width:500px;
    height:100px;
    margin:30px;
}

div.icon
{
    background-image: url("http://i46.tinypic.com/zmmbo8.png");
    background-repeat: no-repeat;
    height: 50px;
    left: 540px;
    position: relative;
    top: -104px;
    width: 50px;
    cursor:pointer;
}

div.icon iframe
{
    display:none;
    position:relative;
    top:30px;
}

div.product-image iframe
{
    position: absolute;
    top: 42px;
    left:42px;
}

JQ:

var $video=$('div.icon iframe');
var $productImage=$('.product-image');
var $icon=$('.icon');
$icon.on('click',function()
{
    $('.product-image').append($video);
});

jsfiddle:
http://jsfiddle.net/t7qMF/2/

  • 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-06T02:42:55+00:00Added an answer on June 6, 2026 at 2:42 am

    For Q1 Ishan is rigth you can use:

    $('img[src="images/test.png"]').css("position","absolute");
    

    For Q2: A youtube embed code looks like this:

    <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
    

    You can try using the iframe class to select it:

    var $video=$('iframe.youtube-player');
    var $productImage=$('.product-image');
    var $icon=$('.icon');
    $icon.on('click',function()
    {
        $('.product-image').append($video);
    });
    

    Then on the onload event you have to add some jquery thats gonne wrap every youtube iframe with your icon div. I’m not sure but this could be something like:

    $(function() {
         $('iframe.youtube-player').each(function(){
             var $iconDiv = $(this).parent().append('<div class="icon"></div>');
             $(this).prependTo($iconDiv);
         });
    });
    

    Hope this help’s

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

Sidebar

Related Questions

Is there any possible way to PLAY a you tube video on page load
Possible Duplicate: jQuery $.get or $.post to catch page load error (eg. 404) Maybe
Essentially, on page load, I want a video to be hidden behind an image
I'm using jquery ui in my page for a dropdown menu. But this file
I have a page containing a set of jQuery tabs. All the tabs point
I need to load images after page load completed in ASP.Net without using JQuery.
Possible Duplicate: jQuery refresh if PHP file echo's 'true' I have the following div
I want to use jQuery Lint to check for possible jQuery errors. I wanted
I'm using this following jquery code to insert the responsetext in the div. $(#div).load('page.php?val='+myvalue)
Can I set if-else condition with hover function? I want to load a page

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.