jquery

Trigger Ctrl+P printing for a JQuery Modal Box through keyboard

大憨熊 提交于 2021-01-28 19:52:26
问题 I have a document which pops up on the site within a JQuery Modal Box. The document has a print button at the end which just prints the document in the Pop-Up Box. I am looking to find a solution that I can print the pop-up box by pressing Ctrl+P. Right now Ctrl+p prints all the page including the background ... I am just hoping to find a solution which helps me print the document in the pop-up only. My JQuery Modal Box is in iFrame and is shown in the following way:- <div id="frameContainer"

how to set rails background image url in javascript?

ぃ、小莉子 提交于 2021-01-28 19:51:26
问题 In my rails application, I have some set of content and image-button (each piece of content has an image). When a user clicks the button, I want to show the respective image. In my project, I saved all my images under assets/images/preview/id1.png (for example). In my javascript code, when clicking the view-content button i want to change the background image to display the respective image. I want to lookup the image based on the id assigned to that button. How can I achieve this? How to set

How to show popover on click?

三世轮回 提交于 2021-01-28 19:43:32
问题 I'm currently working in the 0.5 version of Siwapp and I'm trying to show a popover for the payments button on each row of a invoices table. But I have to do it with a click. I have the following JS code: jQuery(function($){ $('table[data-type="invoices"] a.payments').popover({ live: true, placement: 'left', offset: 5, html: true, content: function() { return $(this).attr('class'); }, trigger: 'manual' }).live('click', function(e){ e.preventDefault(); $(this).popover('show'); }); }); The

Passing variable to :eq jquery selector in a while loop

坚强是说给别人听的谎言 提交于 2021-01-28 19:42:47
问题 I'm trying to assign jquery hover functions to all the elements inside <ul> list with this code: var element = 0; var length = $(".artist-list-link").length; while (element<length) { $(".artist-list-link:eq("+element+")").hover(function() { $(".artist-back:eq("+element+")").css('display','block'); $(".artist-hover:eq("+element+")").fadeIn(100); }, function() { $(".artist-back:eq("+element+")").css('display','none'); $(".artist-hover:eq("+element+")").fadeOut(100); }); element++; }; The markup

Javascript map method creating 'Object doesn't support this property or method ' in Internet Explorer (IE)?

吃可爱长大的小学妹 提交于 2021-01-28 19:40:14
问题 javascript code shows error in Internet Explorer but not in FF. $(document).ready(function(){ var countries = [ ["Afghanistan","Af"], ["Åland Islands","Ax"], ["Zimbabwe","Zw"] ]; var countryNames = countries.map(function(country){ return { /*label: '<div class="flag '+country[1].toLowerCase()+'">'+country[0]+'</div>',*/ value: country[0] } var my_var=countryNames(); }); }); In IE 8 developer tool, if I debug js, the error message is :' Object doesn't support this property or method'. And the

Autoplay youtube video on hover/mouseover

梦想的初衷 提交于 2021-01-28 19:32:13
问题 I am trying to play the youtube video for auto play when the iframe tag is on focus. Tried the following but it is not working. Error with my jquery? I want to add &autoplay=1 to the src of iframe when it is focus. Html :- <div class="vid-wrapper" > <iframe width="100%" height="100%" id="video1" src="https://www.youtube.com/embed/bxgorUGjCIw?rel=0" frameborder="0" allowfullscreen scrolling="auto" ></iframe> </div> Css :- .vid-wrapper{ width: 100%; position: relative; padding-bottom: 56.25%;

jQuery Height Altimeter

拟墨画扇 提交于 2021-01-28 19:27:19
问题 I would like to know it would be possible to create a sort of altimeter / counter display that dyamically changes the counter as you scroll. For example when you are in the top of the page it displays 10 000 and as you scroll down it decreases, until it reaches to 0 when you have scrolled to the bottom of the page. It should work according to the scrolling, so when you scroll up it increases and scroll down decreases, with a max range of lets say, 10000 in the top of the page and 0 in the

Autoplay youtube video on hover/mouseover

你。 提交于 2021-01-28 19:20:40
问题 I am trying to play the youtube video for auto play when the iframe tag is on focus. Tried the following but it is not working. Error with my jquery? I want to add &autoplay=1 to the src of iframe when it is focus. Html :- <div class="vid-wrapper" > <iframe width="100%" height="100%" id="video1" src="https://www.youtube.com/embed/bxgorUGjCIw?rel=0" frameborder="0" allowfullscreen scrolling="auto" ></iframe> </div> Css :- .vid-wrapper{ width: 100%; position: relative; padding-bottom: 56.25%;

Form submit button onclick does not call my JS function

☆樱花仙子☆ 提交于 2021-01-28 19:14:33
问题 I have an html form with a submit button. I have a js function in a file that I include in the head. I am trying to bind the onclick event of the button to call that function. However, all the methods I tried did not work. <form class="form-horizontal" role="form" id="form_newCours"> <div class="form-group"> <label class="control-label col-sm-2" for="discippline">Matiere:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="discipline" placeholder="Matiere"> </div> </div

Provide onclick dynamically and avoid duplicate event calling

余生颓废 提交于 2021-01-28 19:11:38
问题 I try to add an item, just like this sample: https://codepen.io/Gobi_Ilai/pen/LLQdqJ var addToMenu = function () { var newName = $("#addInputName").val(); var newSlug = $("#addInputSlug").val(); var newId = 'new-' + newIdCount; nestableList.append( '<li class="dd-item" ' + 'data-id="' + newId + '" ' + 'data-name="' + newName + '" ' + 'data-slug="' + newSlug + '" ' + 'data-new="1" ' + 'data-deleted="0">' + '<div class="dd-handle">' + newName + '</div> ' + '<span class="button-delete btn btn