The video display does not adjust to the width of the screen

I need some assistance with a website I'm working on, accessible at www.bigideaadv.com/xsp. My goal is to have a video pop up when the user clicks on the watch video link. The challenge I'm facing is that I want the video to expand both the width and height of the browser by 242px. Everything works perfectly in Firefox as the video resizes accordingly when the window size changes. However, Safari and IE 7+ are presenting issues. Although the variables update with new values upon resize, the CSS properties remain static at the initial video size. Any thoughts or suggestions would be greatly appreciated. Thank you in advance. Below is the relevant code:

function resize() {
    var viewportwidth;
    var viewportheight;

    if (typeof window.innerWidth != 'undefined') {
        viewportwidth = window.innerWidth;
        viewportheight = window.innerHeight;
    } else if (typeof document.documentElement != 'undefined' 
          && typeof document.documentElement.clientWidth != 'undefined' 
          && document.documentElement.clientWidth != 0) {
        viewportwidth = document.documentElement.clientWidth;
        viewportheight = document.documentElement.clientHeight;
    } else {
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
        viewportheight = document.getElementsByTagName('body')[0].clientHeight;
    }

    viewportheight = viewportheight - 242;

    $('#sublime_video_wrapper_0').css('width', viewportwidth);
    $('#sublime_video_wrapper_0').css('height', viewportheight);
    $('#sublime_vixdeo_wrapper_0').css('z-index', '1003');
    $('#slide1video embed').css('width', viewportwidth);
    $('#slide1video embed').css('height', viewportheight);
    $('#slide1video embed').css('z-index', '1002');
    $('#slide1video').css('width', viewportwidth);
    $('#slide1video').css('height', viewportheight);
    $('#slide1video').css('z-index', '1001');
    $('video.sublime').css('width', viewportwidth);
    $('video.sublime').css('height', viewportheight);
    $('video.sublime').css('z-index', '1000');
};​ 

Answer №1

Forget about using complicated JavaScript code, you can simply use CSS to achieve the desired result. Just set the width and height of the video to 100% and apply the parent CSS property max-width:100%;

Answer №2

Your CSS needs some adjusting, I'm not entirely familiar with how sublime video functions but it seems like the video container is set to a fixed height of 200px and a fixed width of 400px. You could try this solution:

#sublime_video_wrapper_0{
   width:100% !important;
   height:100% !important;
}

This should resolve the issue for webkit browsers, possibly even IE although I haven't tested it myself.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Enhancing HTML on iPad devices

Having trouble focusing a text field on my iPad. I'm using the following code: $(document).bind("click",function(event) { alert('click'); focusTextArea(); }); When triggered by a click event, focusTextArea successfully sets focus t ...

Modify the value of a variable's color using a combination of bootstrap, JavaScript, and jinja2

I need to show different colors for various Jira statuses such as Open, In Progress, Reopened, Resolved, and Closed. The current solution is functional, but I am searching for a more efficient method. {% set state = 'Closed' %} {% if state ==&ap ...

Restricting the input field in jQuery to only accept the maximum value based on the

There are two input fields: discountType and discountAmount. My goal is to set restrictions based on the value of discountType: if it's percentage, the discountAmount input should only accept numbers between 0 and 100; if it's absolute, any numbe ...

Create three separate input fields in place of one

I recently integrated the Spectrum Color Picker, and now I am looking to make a few modifications. My goal is to display RGB colors in three different input fields. I also aim to showcase the hex color in a separate input field. Furthermore, I would like ...

Having difficulty accessing the uploaded file through the <input type="file"> feature

I need help with uploading a file using the input type="file" and then sending it via email along with other data. However, when I receive the email, I can see all the text data but not the uploaded file. The file path displayed is something like "C:\ ...

Issues with alignment in Firefox

My table alignment is off in Firefox but looks fine in Chrome and IE. Do I need to add an "FF Fix" for this issue? In Chrome/IE, the little dot in the bottom right corner of each cell appears correctly, but in Firefox it seems to be misplaced in the top r ...

Using Testcafe to extract the value attribute of a hidden input element

Is there a way to retrieve the value of an <input>, especially what is contained within its value attribute even if the input is not visible? I am using testcafé, but it seems like this could be a challenge. Does anyone have any suggestions or opti ...

CSS Alignment in React with Material UI

Is there a way to align one button to the left while centering the other two? To see an example in Codesandbox, please visit HERE <DialogActions sx={{ justifyContent: "center" }}> <Button>Left</Button> <Button on ...

unexpected automatic scrolling that occurs when hovering over an element

a sudden scrolling takes effect simultaneously with hovering on an element. What confuses me more is that it does not happen every time I hover over the element but just occasionally or maybe there is a specific scrolling position that I can't see yet ...

Header and footer remain unaligned

Bookstore.html <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> ul { list-style-type: none; padding: 20px; overflow: hidden; background-color: black; width:1230px; p ...

Having some trouble integrating CSS with JavaFx; encountering an error

Can anyone help me with using CSS in JavaFx? I'm encountering an error while trying to add a CSS file (style.css) to my fxml file through stylesheets. The error message I'm getting is: com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged W ...

"Encountering issue with jQuery $.ajax DELETE not triggering then() function

I have implemented some code within a Chrome extension that effectively utilizes the then() method from the xhr response when using $.ajax. if (request && request.action === "updateTask") { $.ajax({ type: "PUT", url: config.upda ...

Can ffprobe (fluent-ffmpeg) be used to read a stream input in node.js?

I've been working with fluent-ffmpeg in my code to extract the audio/video duration. My specific requirement is to use a stream as my input source. As per the documentation provided at this link, ffmpeg('/path/to/file1.avi') .input(' ...

Excessive white space on WordPress pages is creating a less than ideal

On my WordPress page, I have set up a row with the main side at span10 and the right sidebar at span2. However, the layout leaves too much blank space, causing users to scroll to the right and see nothing. You can view the specific page here Below is the ...

Ways to access a JavaScript object beyond the function scope

Using the code below, I am able to retrieve JSON data when an element is clicked. This data is then used to create a table, fill the cells with images, and append the table to a specific div. function LoadImagesByCategory() { $.getJSON("/Service/GetJs ...

PHP incorporate diverse files from various subfolders located within the main directory

My question is similar to PHP include file strategy needed. I have the following folder structure: /root/pages.php /root/articles/pages.php /root/includes/include_files.php /root/img/images.jpg All pages in the "/root" and "/root/art ...

Looking to retrieve a specific portion of HTML data returned from an AJAX request

Looking to extract specific HTML content from the response received from an ajax call made to the controller. This task will involve utilizing an ID reference. I am encountering difficulty in employing the find function directly on the data as it is curre ...

Reformat a table in Asp.Net Bootstrap to ensure optimal display on mobile devices through a media query,

I came across this code on the following website: https://css-tricks.com/responsive-data-tables/, but unfortunately, it is not functioning as expected for my specific table within a Razor view. Here is the table code that I am using: <table class=" ...

Transferring the link value to an AJAX function when the onclick event is triggered

I have a link containing some data. For example: <li><a href="" onclick="getcategory(this);"><?php echo $result22['category']; ?></a></li> I need this link to pass the value of $result22['category']; to ...

The onClick() function in JavaScript is encountering issues on the Firefox OS mobile application

I've been working on an app for Firefox OS mobile devices where I'm trying to trigger a Javascript function onClick() from a div attribute. It's functioning properly in regular browsers, but when I test it in the simulator, the onClick funct ...