#StackBounty: #javascript #html #datatable datatable print complex header print preview

Bounty: 50

hi im working with datatable and its great but i have problem thats in complex header like this

<thead>
    <tr><td>some text</td></tr>
    <tr><td>some text</td></tr>
</thead>

now in showing page its like like this
enter image description here
when i hit print preview i gat result like this
enter image description here

that the first tr in thead is gone
i opened datatable.js file and i found this

        var addRow = function ( d, tag ) {
        var str = '<tr>';

        for ( var i=0, ien=d.length ; i<ien ; i++ ) {
            // null and undefined aren't useful in the print output
            var dataOut = d[i] === null || d[i] === undefined ?
                '' :
                d[i];
            var classAttr = columnClasses[i] ?
                'class="'+columnClasses[i]+'"' :
                '';

            str += '<'+tag+' '+classAttr+'>'+dataOut+'</'+tag+'>';
        }

        return str + '</tr>';
    };

    // Construct a table for printing
    var html = '<table class="'+dt.table().node().className+'">';

    html += '<thead>';

    // Adding logo to the page (repeats for every page while print)
    if(config.repeatingHead.logo) {
        var logoPosition = (['left','right','center'].indexOf(config.repeatingHead.logoPosition) > 0) ? config.repeatingHead.logoPosition : 'right';
        html += '<tr><th colspan="'+data.header.length+'" style="padding: 0;margin: 0;text-align: '+logoPosition+';"><img style="'+config.repeatingHead.logoStyle+'" src="'+config.repeatingHead.logo+'"/></th></tr>';
    }

    // Adding title (repeats for every page while print)
    if(config.repeatingHead.title) {
        html += '<tr><th colspan="'+data.header.length+'">'+config.repeatingHead.title+'</th></tr>';
    }

    if ( config.header ) {
        html += addRow( data.header, 'th' );
    }

    html += '</thead>';

    html += '<tbody>';
    for ( var i=0, ien=data.body.length ; i<ien ; i++ ) {
        html += addRow( data.body[i], 'td' );
    }
    html += '</tbody>';

    if ( config.footer && data.footer ) {
        html += '<tfoot>'+ addRow( data.footer, 'th' ) +'</tfoot>';
    }
    html += '</table>';

and its just add the last tr in thead
but i couldn’t put the first tr with print preview
thanks a lot


Get this bounty!!!

#StackBounty: #javascript #html #css #reactjs #react-day-picker React date picker month / year selection doesn't work on iOS Safari…

Bounty: 50

I am using react-day-picker package to select a date with the year/month props included. However, the year/month dropdown doesn’t work properly on iOS mobile browsers:

import React from 'react';
import ReactDOM from "react-dom";
import DayPickerInput from 'react-day-picker/DayPickerInput';
import 'react-day-picker/lib/style.css';

const currentYear = new Date().getFullYear();
const fromMonth = new Date(currentYear, 0);
const toMonth = new Date(currentYear + 10, 11);

function YearMonthForm({ date, localeUtils, onChange }) {
  const months = localeUtils.getMonths();

  const years = [];
  for (let i = fromMonth.getFullYear(); i <= toMonth.getFullYear(); i += 1) {
    years.push(i);
  }

  const handleChange = function handleChange(e) {
    const { year, month } = e.target.form;
    onChange(new Date(year.value, month.value));
  };

  return (
    <form className="DayPicker-Caption">
      <select name="month" onChange={handleChange} value={date.getMonth()}>
        {months.map((month, i) => (
          <option key={month} value={i}>
            {month}
          </option>
        ))}
      </select>
      <select name="year" onChange={handleChange} value={date.getFullYear()}>
        {years.map(year => (
          <option key={year} value={year}>
            {year}
          </option>
        ))}
      </select>
    </form>
  );
}

export default class Example extends React.Component {
  constructor(props) {
    super(props);
    this.handleYearMonthChange = this.handleYearMonthChange.bind(this);
    this.state = {
      month: fromMonth,
    };
  }
  handleYearMonthChange(month) {
    this.setState({ month });
  }
  render() {
    const dayPickerProps = {
      month: this.state.month,
      fromMonth: fromMonth,
      toMonth: toMonth,
      captionElement: ({ date, localeUtils }) => (
        <YearMonthForm
          date={date}
          localeUtils={localeUtils}
          onChange={this.handleYearMonthChange}
        />
      )
    };

    return (
      
); } } ReactDOM.render(<Example />, document.getElementById("root"));

You can see the demo on this link (must open it on an iOS device):

https://codesandbox.io/s/0y84wrp8mn

Any workaround for this?


Get this bounty!!!

#StackBounty: #html #css CSS Submeu appears on hover, but disappears when when I try to go to submenu

Bounty: 100

Hi all I have this menu like so:

As you can see I have a submenu inside a submenu, now when I hover over “In Person” my submenu appears, but disappears when I try to go to the submenu, how do I fix that? Here is my CSS:

li.menu-in-person ul.dropdown-menu {
  display: none !important;
}

li.menu-in-person:hover ul.dropdown-menu,
li.menu-in-person ul.dropdown-menu:hover {
  display: block !important;
}

.navbar .navbar-nav li:last-child .dropdown-menu {
  right: -174px;
  left: auto;
  top: 0px;
}
<li class="dropdown menu-services"><a class="dropdown-toggle" href="#">Services <b class="caret"></b></a>
  <ul class="dropdown-menu">
    <li class="menu-online"><a href="http://example.com/online-health-coaching/">Online</a></li>
    <li class="dropdown menu-in-person"><a href="#">In Person</a>
      <ul class="dropdown-menu">
        <li class="menu-classes"><a href="http://example.com/classes/">Classes</a></li>
        <li class="menu-corporate-wellness"><a href="http://example.com/corporate-wellness/">Corporate Wellness</a></li>
      </ul>
    </li>
  </ul>
</li>


Get this bounty!!!

#StackBounty: #html #gui #user-interface #rest #gui-builder Simple Web UI builder for backend devs

Bounty: 50

I’m a backend dev who technically knows how to work with html css js… but hates it. Is there a low-code free or OSS tool where I can quickly build or prototype simple web guis for my backend services? Functionality should be something like drag and drop UI components like buttons and form fields, sending rest requests and parsing the JSON or XML responses and displaying them or part of them in tables or lists or generating lists of links based on responses from my services. Doesn’t need to be fancy at all, a plain unstyled html look would work just fine as long as the amount of html/css/js that needs to be written is minimized.


Get this bounty!!!

#StackBounty: #html #css #internet-explorer Fixing IE11's image rescale bug?

Bounty: 50

As a little experiment, I am trying to fix the wrongly rescaled images one gets when opening the snopes.com homepage using IE11. (See screenshot)

Snopes homepage

Just to clarify, I am not the owner of the website.

I can see that the affected images belong to a class named “bg-image”, but as a beginner, I have almost no idea where to go from there.

Can anyone suggest a quick’n’dirty fix that I can just try out from IE’s devtools console?


Get this bounty!!!

#StackBounty: #javascript #jquery #html #css Drag and Drop not working when there are no elements present

Bounty: 50

I am doing drag and drop between two containers , its working fine when there is at least one element present in the container. But when I drop all elements in either of them and try to drop them back, it’s not working.

HTML:-

First DIV
TAG A
</div> </div> </div> </div> <hr> <hr> <hr> <hr>
SECOND DIV
TAG B
</div> </div> </div>
TAG A
</div> </div> </div> </div> </div>

javaScript:-

var PortletDraggable = function () {

    return {
        //main function to initiate the module
        init: function () {

            if (!jQuery().sortable) {
                return;
            }

            $("#sortable_portlets").sortable({
                connectWith: ".portlet",
                items: ".portlet", 
                opacity: 0.8,
                handle : '.portlet-title',
                coneHelperSize: true,
                placeholder: 'portlet-sortable-placeholder',
                forcePlaceholderSize: true,
                tolerance: "pointer",
                helper: "clone",
                tolerance: "pointer",
                forcePlaceholderSize: !0,
                helper: "clone",
                cancel: ".portlet-sortable-empty, .portlet-fullscreen", // cancel dragging if portlet is in fullscreen mode
                revert: 250, // animation in milliseconds
                update: function(b, c) {
                    if (c.item.prev().hasClass("portlet-sortable-empty")) {
                        c.item.prev().before(c.item);
                    }   
                },


                stop: function(event, ui) {
                                }
            });
        }
    };
}();

jQuery(document).ready(function() {
    PortletDraggable.init();
});

https://jsfiddle.net/33keyjxx/26/


Get this bounty!!!

#StackBounty: #android #html #css #mobile How to fix keyboard above content on android (manifest.json)

Bounty: 50

I’m trying to setup my site to open as an app when people add it to their homepage on mobile but it’s not working as expected when I have input fields. When the keyboard shows up it stays above the content, it doesn’t get resized. It happens only when using via a shortcut on the phone homescreen.

This is my manifest.json:

{
  "author": "My Name",
  "background_color": "#ffffff",
  "description": "App",
  "display": "fullscreen",
  "icons": [
    {
      "src": "https://192.168.26.183:8080/img/web-app.png",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "manifest_version": 2,
  "name": "App",
  "orientation": "portrait",
  "short_name": "App",
  "start_url": "https://192.168.26.183:8080/",
  "theme_color": "#ffffff",
  "version": "0.1"
}

This is my html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <!-- Ask user to add to home screen -->
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <link rel="manifest" href="manifest.json">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body,
        html {
            height: 100%;
        }
        .teste {
            height: calc(100% - 10px);
            width: 100%;
            content: '';
            background-color: red;
        }
    </style>
</head>
<body>
    
<input type="text" id="texteeee"> </body> </html>


Get this bounty!!!

#StackBounty: #jquery #html #css #animation #dom jQuery Slideshow with pagination

Bounty: 50

The code below is for a slideshow that shows an .active slide, pre-loads a .next slide, and holds the .last slide in the background.

My big issue with this is there seems to be duplication and probably very inefficient code here that I would like to improve upon, but do not yet have that complete knowledge.

I am not looking for the code rewritten, but would like to hear of ideas that can improve not only my knwoledge of jQuery but also the effiency of the code.

<

div class=”snippet” data-lang=”js” data-hide=”false” data-console=”true” data-babel=”false”>

$(document).ready(function() {

  $('.slide:eq(-1)').addClass('last');
  $('.dot:first').addClass('active');
  $('.slide:first').addClass('active').delay($duration).queue(function() {
    $(this).addClass('show-text');
  });
  $('.slide:eq(1)').addClass('next');

});

// Globals
var $classes = 'last active show-text next';
var $duration = 1250;

// Function for the pagination operation
$('.dot').on('click', function() { // the dot click

  var $This = $(this);
  // Match the index to the slide numbers
  var GetIndex = $This.closest('li').index() + 1;

  $('.dot').removeClass('active').filter($This).addClass('active');

  $('.slide').dequeue();
  $('.slide').removeClass($classes);

  // Show new active slide
  $('#slide' + GetIndex).addClass('active').delay($duration).queue(function() {
    $(this).addClass('show-text');
  });
  // Add class to previous slide
  $('.slide').eq(($('.slide.active').index() - 1) % $('.slide').length).addClass('last');
  // Add class to next slide
  $('.slide').eq(($('.slide.active').index() + 1) % $('.slide').length).addClass('next');

});

$('.button').click(function moveSlide() {

  // Variables for moving slide
  var $active = $('.slide.active');
  var $prevSlide = $('.slide').eq(($active.index() - 1) % $('.slide').length);
  var $afterPrevSlide = $('.slide').eq(($active.index() - 2) % $('.slide').length);
  var $nextSlide = $('.slide').eq(($active.index() + 1) % $('.slide').length);
  var $slideAfterNext = $('.slide').eq(($active.index() + 2) % $('.slide').length);

  // Variables for pagination
  var $tagNextDot = $('#' + $prevSlide.attr('id') + 'Dot');
  var $tagPrevDot = $('#' + $nextSlide.attr('id') + 'Dot');

  $active.dequeue();
  $('.slide').removeClass($classes)
  $('.dot').removeClass('active');

  if ($(this).is("#prev")) {

    $active.addClass('next');
    $tagNextDot.addClass('active');
    $prevSlide.addClass('active').delay($duration).queue(function() {
      $(this).addClass('show-text');
    });
    $afterPrevSlide.addClass('last');

  } else {
    $active.addClass('last');
    $tagPrevDot.addClass('active');
    $nextSlide.addClass('active').delay($duration).queue(function() {
      $(this).addClass('show-text');
    });
    $slideAfterNext.addClass('next');
  }

});
body {
  font-size: 16px;
  font-family: 'Heebo', sans-serif;
  text-transform: uppercase;
  font-weight: 900;
}


/* Slides */

.slide-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  display: flex;
  overflow: hidden;
}

.slide {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 70%;
  left: 140%;
  z-index: 0;
  transition: 1.25s;
  box-shadow: -10px 0px 21px -5px rgba(0, 0, 0, 0.5);
}

.slide h2 {
  display: none;
  color: #fff;
  text-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: -2px;
  font-size: 3rem;
}

.slide.active.show-text h2 {
  display: block;
  animation: reveal-text 1.5s forwards;
}

@keyframes reveal-text {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

#slide1 {
  background: linear-gradient(to right, #ff416c, #ff4b2b);
}

#slide2 {
  background: linear-gradient(to right, #00b4db, #0083b0);
}

#slide3 {
  background: linear-gradient(to right, #59c173, #a17fe0, #5d26c1);
}

#slide4 {
  background: linear-gradient(to right, #ad5389, #3c1053);
}

.slide.last {
  left: 0;
  z-index: 0;
}

.slide.active {
  left: 0;
  z-index: 1;
}

.slide.next {
  left: 70%;
  z-index: 2;
}

.dots-wrapper {
  z-index: 10;
  list-style: none;
  padding-left: 0;
  position: absolute;
  bottom: 0;
  padding: 10px;
}

.dots-wrapper li {
  display: inline;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 6px;
}

.dot.active {
  background-color: red;
  border-color: red;
}


/* Buttons */

.button-wrapper {
  display: flex;
  z-index: 10;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

.button {
  background-color: rgba(0, 0, 0, 0.45);
  color: #ddd;
  height: 40px;
  border: none;
  font-weight: bold;
  padding: 10px 20px;
  transition: 0.3s;
}

.button:hover {
  cursor: pointer;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
}
https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js

Slide One.

Slide Two.

Slide Three.

Slide Four.

<ul class="dots-wrapper"> <li> <span id="slide1Dot" class="dot"></span> </li> <li> <span id="slide2Dot" class="dot"></span> </li> <li> <span id="slide3Dot" class="dot"></span> </li> <li> <span id="slide4Dot" class="dot"></span> </li> </ul> </div>


Get this bounty!!!