width

jquery if width is less than, change this attr

二次信任 提交于 2019-12-08 07:31:12
问题 $(".section").each(function(i, el){ var section = $('.section'); var width = section.width(); if (width < 960) section.attr('class', 'section-slim'); }); This seems to work fine, on browser refresh, how do I make it act when resized? Ex: if someone makes their browser window smaller, it will add this class? 回答1: bind the event to jQuery's "resize" event $(window).on("resize load", function () { $(".section").each(function(i, el){ var section = $('.section'); var width = section.width(); if

Highcharts — how to change line width programmatically and prevent resetting line width?

假装没事ソ 提交于 2019-12-08 07:29:06
问题 I created a line chart, and added a button whose click method make the line thicker (lineWidth 7pt). However, each time I mouse over the line or the legend, the line restore to its original width (which I believe is 2 pt). So I added the following plot options to disable the "hover" function: line: { states: { hover: { enabled: false, } } }, But it only resolves the issue partially -- after I set lineWidth to 7 pt using the button, the line width will still be reset to its original 2 pt after

Set Div TOP position as percentage of browser width (define height position by width)

对着背影说爱祢 提交于 2019-12-08 06:11:29
问题 I am assuming I will need Javascript for this, but perhaps there is a CSS trick I'm not aware of. I have a web page based on a square background image. Ideally, the user would always set the browser as a square, but I know that won't happen. Because the image is square, if the image is set to fill the browser at 100%, the width is always the same as where the "bottom" of the page should be. Thus, to position an element dynamically horizontally (so the page can be resized but still hold it's

Altering meta viewport tag

别等时光非礼了梦想. 提交于 2019-12-08 05:44:07
问题 I need to alter the meta viewport tag dependent upon the width of the visual viewport. I know HOW to do it but it's not working, I think it's because the site is running that bit of JS too late for it to take effect. It may not be this but this is my first thought. In my application.js file: $(document).ready(function() { // If screen width is 480 or less then add meta viewport tag // (so default mobile display is used on iPads until that optimised view is added) if (window.innerWidth <= 480)

How to add the widths of all the images in a div with JQuery

我与影子孤独终老i 提交于 2019-12-08 04:11:16
问题 I was looking for a way to change the width of a div to the sum of all the widths of the images within that div. In other words, I wanted #page-content to have a width that is equal to the width of all the images inside it. This is because i would like the page-content div to be wider than the browser window, so that the user can scroll from left to right. the code I had was as follows: <div id="page-content"> <div id="gallery"> <div> <a href="#" class="shutterset"> <img src="images/pic1.jpg"

WPF DataGridColumnWidth doesn't work well when PrintVisual

倖福魔咒の 提交于 2019-12-08 04:00:30
问题 I have a ucReceipt.xml that looks fine in design mode or even it looks good while Opening the window http://prntscr.com/5xl11h: <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Receipt.ReceiptItems}" IsReadOnly="True" CanUserSortColumns="False" CanUserResizeColumns="False" RowHeaderWidth="0" Grid.Row="4"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding ItemNo}" Header="No" Width="0.5*" /> <DataGridTextColumn Binding="{Binding cloth.Name}" Header="Description" Width="*" />

Facebook Comments Plugin Displays Mobile Width on iPad

懵懂的女人 提交于 2019-12-08 03:23:55
问题 As the title says. Here is the URL if you have an iPad - How can I remove the responsive width of the Comments Plugin for iPads? (bottom of page) http://dev.assessmentday.co.uk/aptitudetests_numerical.htm 回答1: I ran into this too. I've worked around it by manually adding the data-mobile attribute set to false if I detect this is on an iPad: <script> if (navigator.userAgent.match(/\biPad\b/)) { document.querySelector('div.fb-comments') .setAttribute('data-mobile', 'false'); } </script> This

jQuery: div pops back to full size after animation

天涯浪子 提交于 2019-12-08 01:59:21
问题 In the jQuery example below, I have one div inside another. When I animate the inner div down to a width of 0, the outer div (which has absolute positioning), decreases in width along with it. This is desired. The trouble is that after the animation is complete, the outer div pops back to its original size. Is this expected? How can I keep this from happening? Thanks! Example html: <div class="outer"><div class="inner">innerContent</div></div> css: div.outer { position: absolute; padding:

Cross-browser method for getting width and height of a DIV?

纵然是瞬间 提交于 2019-12-08 00:50:00
问题 This is my first post, so please go easy on me. I'm sure I'm doing everything wrong. However, I couldn't find any posts that answered the question above. I use jQuery. I'm trying to find a way to get the current width and height of a DIV element, even if they're set to "auto". I've found many ways to do this, but no method returns the same width in IE. It is important that this method is cross-browser, as it will break the layout of the page if different numbers are returned in different

CSS Width:100% not working in Google Chrome

柔情痞子 提交于 2019-12-07 23:15:43
问题 I'm trying to build gallery-section with captions based on figure and figcaptions . It must be responsive and work with different height / width along with its figcaption`. Everything works well in firefox , but unfortunately chrome doesn't follow the 100% width in CSS which is significant. figure { margin: 6px; color: #333; /*display: table; float: left;*/ display: inline-block; -webkit-box-sizing: border-box ; -moz-box-sizing: border-box ; box-sizing: border-box ; } figure figcaption {