- Screen name: marcopolo2012
marcopolo2012's Profile
24 Posts
19 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 23-Jul-2020 10:59 AM
- Forum: Using jQuery
Can you please take a look at this Demo and let me know why I am not able to use the
$('.quantity').each(function()
when adding the content dynamically to the document? As you can see the$('.quantity').each()
is functioning properly when is hard coded but not working on dynamic content$('.quantity').each(function() { });
- 13-Nov-2018 09:13 AM
- Forum: Using jQuery
Can you please take a look at this demo and let me know how I can enable previous button to slide to? as you can see the next button is working fine but I am not able to slide back$("#slideshow > div:gt(0)").hide(); $("#next").on("click", function(){ $('#slideshow > div:first') .fadeOut(1000) .next() .fadeIn(1000) .end() .appendTo('#slideshow'); }); $("#prev").on("click", function(){ $('#slideshow > div:prev') .fadeOut(1000) .next() .fadeIn(1000) .end() .appendTo('#slideshow'); });
<button id="next"> next</button>
<button id="prev"> prev</button> <div id="slideshow"> <div> <img src="http://farm6.static.flickr.com/5224/5658667829_2bb7d42a9c_m.jpg"> </div> <div> <img src="http://farm6.static.flickr.com/5230/5638093881_a791e4f819_m.jpg"> </div> <div> Pretty cool eh? This slide is proof the content can be anything. </div> </div>
- 07-Sep-2018 02:38 PM
- Forum: Using jQuery
I am able to check and uncheck some checkboxes on jQuey ui slider stop() using following code. But this looks like is not adding any event to the check boxes!. As you can see the check boxes are re-acting against direct check in out by logging on console but doing nothing when slider change. Can you please let me know why this is happening and how I can fix this?- $(function() {
- $("#slider-range").slider({
- range: true,
- min: 50,
- max: 54,
- values: [50, 54],
- stop: function(event, ui) {
- var selected = [];
- $('input:checkbox[name=temple]').prop("checked", false);
- $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
- for (var i = ui.values[0]; i <= ui.values[1]; i++) {
- selected.push(i);
- }
- $.each(selected, function(index, value) {
- $("input:checkbox[name=temple][value=" + value + "]").prop("checked", true);
- })
- }
- });
- $("#amount").val("$" + $("#slider-range").slider("values", 0) +
- " - $" + $("#slider-range").slider("values", 1));
- });
- $('input:checkbox[name=temple]').on('change', function() {
- if ($(this).is(':checked')) {
- console.log('Checked');
- } else {
- console.log('Un Checked');
- }
- });
- 10-Jun-2018 12:33 PM
- Forum: Using jQuery UI
I am trying to increase the
width
of an element (.inner
) using jQuery Ui slider. This is somehow working fine but I need to keep thecenter
of theinner
always in the center of.wrapper
. so I think I need to add negative values fortop
andleft
but I do not know how to achieve them. Do I have to create two custom counter there or is there any better way to achieve this?Here is The Demo
$(function() { $("#slider").slider({ range: "max", min: 300, max: 1000, value: 1, slide: function(event, ui) { $(".inner").css({ "width": ui.value, "height": ui.value }); } }); });
- 04-Jun-2018 11:53 PM
- Forum: Using jQuery
Can you please take a look at This Demo and let me know how I can prevent/stop slidedown function when user move back the cursor to the handler element
For example if you mouse over
Home
the.tab-pane
will slide down and if you move mouse from the.tab-pane
toHome
tab it will re slide down the content. What I need to detect if mouse is coming from associated.tab-pane
do nothing- $('a[data-toggle="tab"]').hover(
- function(e) {
- $(this).parent().addClass('active');
- var target = $(this).data("target");
- $($(e.target).attr('href')).slideDown('slow');
- },
- function(e) {
- $(this).parent().removeClass('active');
- var target = $(this).data("target");
- var targetId = target.replace('#', '');
- var relatedTarget = $(e.relatedTarget);
- if (relatedTarget.attr('id') === targetId) {
- return;
- }
- $($(e.target).attr('href')).hide();
- }
- );
- $('.tab-pane').hover(function(e) {}, function() {
- $(this).slideUp('slow');
- $('.nav-tabs li').removeClass('active');
- });
- 06-May-2017 12:02 PM
- Forum: Using jQuery
Using bootstrap 3 I am trying to add a new HTML element into a dynamic popover like
$(document).on('click', '#send-app', function(){ console.log("Clicked!"); $("#result").html('<p>New HTML Element</p>'); });
but it is not working! Can you please let me know how to fix this? Thanks
$("[data-toggle=popover]").popover({ html: true, content: function() { return $('#popover-content').html(); } }); $(document).on('click', '#send-app', function(){ console.log("Clicked!"); $("#result").html('<p>New HTML Element</p>'); });
.popover { max-width: 300px; }
<div class="container"> <div id="wrap"> <a data-placement="bottom" data-toggle="popover" data-container="body" role="button" data-html="true" href="#" id="login" class="btn btn-default">Send</a> <div id="popover-content" class="hide"> <div class="well well-sm" style="margin-top:16px; padding-top:14px; padding-bottom:0px;"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <div class="input-group"> <input id="email" name="email" class="form-control" placeholder="Email" type="text"> <span class="btn input-group-addon" id="send-app">Send</span> </div> <p class="help-block animated"></p> </div> <div id="result"></div> </div> </div> </div> </div> </div> </div>
Thanks- Can you please take a look at this demo and let me know why I am not able to load the second layers of data in the JSON to bootstrap tab `tab-content`?
- var data = {
- "action": [{
- "id": "1001",
- "name": "Matrix"
- },
- {
- "id": "1002",
- "name": "IP Man"
- },
- {
- "id": "1003",
- "name": "Revenge"
- }
- ],
- "comedy": [{
- "id": "2001",
- "name": "Iceman"
- },
- {
- "id": "2002",
- "name": "Pat & Mat"
- },
- {
- "id": "2003",
- "name": "Sugar"
- }
- ],
- "animation": [{
- "id": "3001",
- "name": "Frozen"
- },
- {
- "id": "3002",
- "name": "Tangled"
- },
- {
- "id": "3003",
- "name": "Croods"
- }
- ]
- };
- for (var i in data) {
- $('.nav-tabs').append('<li role="presentation" class=""><a href="#' + i + '" aria-controls="' + i + '" role="tab" data-toggle="tab">' + i + '</a></li>');
- }
- for (var j = 0; j < data[i].length; j++) {
- var obj = data[i][j];
- $('.tab-content').append('<div role="tabpanel" class="tab-pane" id="' + obj.name + '">' + obj.name + '</div>');
- }
and the HTML is- <div class="container">
- <ul class="nav nav-tabs" role="tablist"></ul>
- <div class="tab-content"></div>
- </div>
- Can you please take a look at this demo and let me know how I can add animation to borders properly so when use clicks on `a` the all previous borders get the `anime100` class after each other in a sequencewhat is happening now is adding the `anime100` to all anime classes at the same time?
- <ul class="">
- <li>
- <div class="box">
- <div class="left"><a href="#">A</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">B</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">C</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">D</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">E</a></div>
- <div class="anime"></div>
- </div>
- </li>
- <li>
- <div class="box">
- <div class="left"><a href="#">F</a></div>
- <div class="anime"></div>
- </div>
- </li>
- .anime{
- height:10px;
- width:0px;
- background:gold;
- transition: all 0.7s;
- }
- .anime100{
- width:250px;
- }
- $("a:eq( 1 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- });
- $("a:eq( 2 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- });
- $("a:eq( 3 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- $('.anime:eq( 2 )').addClass('anime100');
- });
- $("a:eq( 4 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- $('.anime:eq( 2 )').addClass('anime100');
- $('.anime:eq( 3 )').addClass('anime100');
- });
- $("a:eq( 5 )").on("click", function() {
- $('.anime:eq( 0 )').addClass('anime100');
- $('.anime:eq( 1 )').addClass('anime100');
- $('.anime:eq( 2 )').addClass('anime100');
- $('.anime:eq( 3 )').addClass('anime100');
- $('.anime:eq( 4 )').addClass('anime100');
- });
- 22-Feb-2017 12:29 PM
- Forum: Using jQuery
I am trying two write a jquery plugin to track box entering into view and I couldn't figure out how to pass UI value to my plugin and how to use the
topIn()
inside the plugin.Basically this plugin is mean to create a null callback function
boxTopIn
which is re-usable on the client side(function($) { $.fn.boxInView = function(options) { var settings = { boxTopIn: null }; var options = $.extend(settings, options); function topIn(elem) { $(window).scroll(function() { var elemTop = $(elem).offset().top; var screenBot = $(window).height(); if (($(window).scrollTop() + screenBot) > elemTop) { if ($.isFunction(options.onComplete)) { options.onComplete.call(); } options.boxTopIn.call(); } }); } }; })(jQuery); $('#c').boxInView({ boxTopIn: function() { console.log('Box in View'); } });
- 20-Feb-2017 06:22 PM
- Forum: Using jQuery
I am trying to create a custom plugin to update #result value from an option by a plugin functions at This Demo(function($) { $.fn.app = function(elem) { var elem = $.trim(elem.attr('id')); elem = "#" + elem; var elemTop = $(elem).offset().top; function underone() { } function undertwo() { } }(jQuery)); $("#mapper").app({ underone: function() { $("#result").html('Box is Under 1000 '); }, undertwo: function() { $("#result").html('Box is Under 2000 '); } });
but not sure how to handle the functions inside the plugin in a way that if box has been scroolled untill 1000 then apply 'Box is Under 1000 ' and when it is 2000 change to 'Box is Under 2000 '.I mean I can apply many other JS or css rules based on the options.Thanks- 27-Nov-2016 02:36 AM
- Forum: Using jQuery
I am trying to update the content of
.help-block
dynamically with using jQuery but not sure why I am not able to target the.help-block
I know that we can simply use$('.help-block').text(....
but as I said I need to do this through jQuery Traversing mechanism like using followingfind()
ornext()
andfirst()
but none of them did the job!$(function(){ $(".dropdown-menu li a").click(function(){ $("#selector").find('.help-block').html($(this).text()); $("#selector").next('.help-block').html($(this).text()); $("#selector").parent().find('.help-block').html($(this).text()); }); });
<div class="col-md-6"> <div class="form-group"> <div class="col-md-12"> <label class="control-label" for="new-cu-emailinput"></label> <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="selector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> Please Select From the List<i class="fa fa-chevron-right pull-right" aria-hidden="true"></i></button> <ul class="dropdown-menu" aria-labelledby="selector"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li><a href="#">Separated link</a></li> </ul> </div> <span class="help-block pull-right"></span> </div> </div> </div>
- 24-Feb-2016 01:24 PM
- Forum: Using jQuery UI
Can you please take a look at This Demo and let me know how I can dynamically run the slider from value to max and back to min and again ...
$(function() { var slider = $( "#slider" ).slider({ range: "min", min: 1, max: 280, value: 140 }); $('.btn-succes').on('click',function(){ slider.slider('value', slider.slider('value') ); return false; }); });
@import url(https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/images/ui-bg_flat_10_000000_40x100.png)
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/i18n/jquery-ui-i18n.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="container"> <br /> <div class="col-md-2"> <div id="slider"></div> </div> <div class="row"> <button class="btn btn-success">Run</button> <button class="btn btn-info">Stop</button> </div> </div>
- 22-Dec-2015 06:12 PM
- Forum: Using jQuery UI
Can you please take a look at This Demo and let me know how I can Stop Dragging After Dropping in Dropable?
Here is the code I have
$(function() { $( ".draggable" ).draggable({cancel:false}); $( "#droppable-1" ).droppable({ drop: function( event, ui ) { $( this ).addClass( "ui-state-highlight" ); } }); $( "#droppable-2" ).droppable({ drop: function( event, ui ) { $( this ).addClass( "ui-state-highlight" ); } }); $( "#droppable-3" ).droppable({ drop: function( event, ui ) { $( this ).addClass( "ui-state-highlight" ); } }); });
and here is the HTML
<button type="button" id="App-1" class="btn btn-default btn-xs draggable">App-1</button> <button type="button" id="App-2" class="btn btn-default btn-xs draggable">App-2</button> <button type="button" id="App-3" class="btn btn-default btn-xs draggable">App-3</button> <div id="droppable-1" class="droppable ui-widget-header"></div> <div id="droppable-2" class="droppable ui-widget-header"></div> <div id="droppable-3" class="droppable ui-widget-header"></div>
- 27-Oct-2015 05:16 PM
- Forum: Using jQuery
Can you please help me to figure it out how to append receiving data from Ajax into a tbody of an existing table?
In my HTML I have a Table Like:
<table id="example" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%"> <thead> <tr> <th valign="middle" class="c-font">Projects </th> <th valign="middle" class="c-font">Road Length (Km)</th> <th valign="middle" class="c-font">Powerline Length (Km)</th> <th valign="middle" class="c-font">Penstock (Km)</th> <th valign="middle" class="c-font">Installed Capacity (MW)</th> <th valign="middle" class="c-font">Annual Firm Energy (GW/h)</th> <th valign="middle" class="c-font">Cost of Energy ($/MWh)</th> <th valign="middle" class="c-font">Footprint (Km)</th> <th valign="middle" class="c-font">Cost Per Year ($)</th> </tr> </thead> <tbody> </tbody> </table>
and js file is like
request.done(function(data) { console.log(data); });
which the output in console looks like
these are the values to be place in the
<td><tr><td></td></tr>
AnnualFirmEnergy: "91.2335550" CostOfEnergy: "183.835765" CostPerYear: "16771990.38" Footprint: "182.3077770" InstalledCapacity: "31.320802" Penstock: "5000.000000" PowerLineLength: "37.384781" ProjectID: "12910" RoadLength: "29.350976"
- 04-Oct-2015 01:25 AM
- Forum: Using jQuery
Can you please take a look at This Demo and let me know how I can enable scroll to div of selected item from auto complete?- $(document).ready(function () {
- $('#tags').on('change', function () {
- $('#tagsname').html('You selected: ' + this.value);
- $('html,body').animate({
- scrollTop: $("#"+ this.value).offset().top
- });
- }).change();
- $('#tags').on('autocompleteselect', function (e, ui) {
- $('#tagsname').html('You selected: ' + ui.item.value);
- });
- });
Uncaught TypeError: Cannot read property 'top' of undefined- 01-Jul-2015 05:02 AM
- Forum: Using jQuery
Can you please take a look at following code and let me know how I can avoid the delay on only FIRST time of this counting down process?As you can see the counter works fine but there is a delay on first time starting.- var sec = 20;
- var timer = setInterval(function() {
- $('#box').text(sec--);
- if (sec == -1) {
- $('#box').css('color','blue');
- clearInterval(timer);
- }
- }, 1000);
- <div id="box">20</div>
ThanksCan you please take a look at This Demo and let me know why the tooltip is not showing on the path on mouse over using jquery Ui and Raphael.js?
<div id="canvasDiv"></div> $(function () { var paper = Raphael(0, 0, 500, 500); var d = "M90,90l-80,-20L50,5L90,90"; var tri = paper.path(d).attr({ "fill": "yellow", "stroke-width": 5, "stroke-linejoin": "round", "title": "Show Me The Tooltip!" }); $(tri).tooltip(); });
- 25-Mar-2015 05:42 PM
- Forum: Using jQuery
I am trying to Rename an image when uploading it. I have a text field with id of newName now I would like to pass it into FormData ( ) and over write it on the file name in the PHP fileHere is the the code I have<input type="text" id="newName" />
$(document).ready(function (e) {
var newName = $("#newName").val(); $('#imageUploadForm').on('submit',(function(e) { e.preventDefault(); var formData = new FormData(this); $.ajax({ type:'POST', url: $(this).attr('action'), data:formData, cache:false, contentType: false, processData: false, success:function(data){ console.log("success"); console.log(data); }, error: function(data){ console.log("error"); console.log(data); } }); })); $("#ImageBrowse").on("change", function() { $("#imageUploadForm").submit(); }); });
Can you please let me know how to do it?
Thanks
- 24-Mar-2015 06:12 PM
- Forum: Using jQuery
Can you please take a look at This demo let me know how I can force Javascript to push the items into the array based on the items id?<!-- begin snippet: js hide: false --><!-- language: lang-js -->- var theArray = [
- ["A", "B", "C"],
- ["D", "E"],
- ["F", "G", "H", "I"],
- ["J"],
- ["K", "L", "M"]
- ];
- var res = theArray.toString();
-
- $('#textarea').text(res);
-
- $("input[name='m1']").change(function () {
- if ($(this).is(':checked')) {
- var id=$(this).attr('id');
- var selected = $(this).val();
- theArray[1][id] = selected;
- } else {
- var itemtoRemove = $(this).val();
- theArray[1].splice($.inArray(itemtoRemove, theArray[1]),1);
-
- }
- var res = theArray.toString();
- $('#textarea').text(res);
- });
-
-
- <!-- language: lang-html -->
-
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
- <br />
- <textarea id="textarea" rows="2" cols="100"></textarea>
- <br />
- <br />
- <fieldset>
- <legend>Items</legend>
- <input type="checkbox" id="1" name="m1" value="mItem1" />mItem 1
- <br />
- <input type="checkbox" id="2" name="m1" value="mItem2" />mItem 2
- <br />
- <input type="checkbox" id="3" name="m1" value="mItem3" />mItem 3
- <br />
- <br />
- </fieldset>
As you can see the example works if you un check from `mItem 3` to `mItem 3` but if you uncheck `mItem 1` first and check it again it will overwrite the mitem2 in the array (which make seance!)Can you please let me know how i can fix this?Thanks- Can you please take a look at This Demo let me know how I can load items into the
ul
list as an endless list. as you can see I have this list as following code but I need to add items again and again at the end of each time list.- var item = $(".thumbnail").width();
- var paddT = $(".thumbnail").css('margin-left');
- item = item + 20;
- $(".leftslide").on("click", function () {
- $(".list-inline").animate({
- left: '-=' + item + 'px'
- }, 300);
- });
- $(".rightslide").on("click", function () {
- $(".list-inline").animate({
- left: '+=' + item + 'px'
- }, 300);
- });
Can you please take a look at this DEMO and let me know how I can use jQuery to scroll to the selected row or animate that row to the middle of the scrolled div
sc
?Here is the code:
- <div id="sc">
- <table id="mytable"></table>
- </div>
- <button class="25">Scrool to 25</button>
- <button class="75">Scrool to 75</button>
- <button class="125">Scrool to 125</button>
- <button class="199">Scrool to 199</button>
- <button class="0">Scrool to 0</button>
- <script>
- $(document).ready(function () {
- for (var i = 0; i < 200; i++) {
- $('#mytable').append('<tr class=' + i + '><td>This is Row' + i + ' </td></tr>');
- $("#125").click(function() {
- $('#sc').animate({
- scrollTop: $("#sc").offset().top}, 2000);
- });
- }
- });
- <script>
Thanks alot
- 25-Feb-2013 05:24 PM
- Forum: Using jQuery Plugins
Can you please take a look at following image and let me know what is the name of this adds-on which let user change the page background color or style on line?Can you please let me know where can I find jquery plugin like this?
Thanks
- Hi,Can you please take a look at following jquery Code and let me know how I can stop infinitive looping inside the program:
- $(document).ready(function()
{
var comp = new Array("AAPL","MSFT","XRTX&");
var t = setInterval(function(){getPrice();},2000);
function getPrice()
{
for (var i=0;i<comp.length;i++){
$.getJSON('https://finance.google.com/finance/info?client=ig&q='+comp[i]+'&callback=?', function(response){
var stockInfo = response[0];
var stockString = '<div class="stockprice">';
stockString += 'Price is $'+''+stockInfo.l+'';
stockString += '</div>';
$('body').append(stockString);
$('.stockprice').replaceWith(stockString);
$(".stockprice:contains('-')").addClass('red'); $(".stockprice:contains('+')").addClass('green');
});
}
}
});
As you can see what I am trying to do is getting qutes from Google Finance and rendering them in array of divs(based on var comp = new Array("AAPL","MSFT","XRTX&");) I also would like to update the divs based on my code on $('.stockprice').replaceWith(stockString); which is working fine but the problem is code is generating no stop divs!Can you please let me know how to fix itThanks for ur time- Can you please let me know how we can add divs to body or other content based on an array size?for example if I have an array of var arr = [ "one", "two", "three", "four", "five" ] how I can add 5 div based on this into body?
- «Prev
- Next »
- $(document).ready(function()
Moderate user : marcopolo2012
© 2013 jQuery Foundation
Sponsored by
and others.