- Screen name: pallavi1811
pallavi1811's Profile
19 Posts
32 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- HiI have a dynamic carousel. in which item varies from 2 to 14.Now if i have 2 items, then i want to show as soon as i load the carousel the right arrow disabled. How wud i show it on loading the carousel itself.Below is the code to handle the carousel arrows.
- function filterArrowButtonWasClicked(event) {
- var content = $('carousel_content');
- var offset = parseInt(content.readAttribute('data-offset'), 10);
- var no_of_products = parseInt(ACProductBrowser.products.products.length, 10);
- var remainingProducts = Math.floor(no_of_products % 6);
- var totalWidth = 138.5 * remainingProducts;
- var slideTo = totalWidth + 830;
- var initialWidth = 830;
- if (no_of_products <= 6 || no_of_products < 12 ) {
- initialWidth = totalWidth;
- slideTo = totalWidth;
- } else {
- initialWidth = 830;
- }
- if (event.target.id == 'right_arrow') {
- $('left_arrow').removeClassName('disabled');
- offset = Math.max(offset - initialWidth, -slideTo);
- if (offset == -slideTo) {
- $('right_arrow').addClassName('disabled');
- }
- } else {
- $('right_arrow').removeClassName('disabled');
- offset = Math.min(offset + initialWidth, 0);
- if (offset == 0) {
- $('left_arrow').addClassName('disabled');
- }
- }
- content.writeAttribute('data-offset', offset);
- content.style.webkitTransform = 'translateX(' + offset + 'px)';
- content.style.MozTransform = 'translateX(' + offset + 'px)';
- content.style.OTransform = 'translateX(' + offset + 'px)';
- content.style.msTransform = 'translateX(' + offset + 'px)';
- content.style.left = offset + 'px';
- }
But this function will be called only when i click any arrow. in case of two items, the arrows shud be disabled right away. how to do this?
- hii am not able to understand how to get my json picked in autocomplete UI widget.
- for(var i=0, l = data.itemisedBill.length; i<l;i+=1){
- var itemLength=data.itemisedBill[i].item;
- $(itemLength).autocomplete({
- source: $[data.itemisedBill]
- });
- }
It is giving exception in the source part? how should i give my json here. I json file is separate.Thanks- HiMy json is not getting available. both are in same folder. Please tell where i am wrong. I am pasting both html and json here:
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Table</title>
- <script type="text/javascript" src="./jquery-1.8.2.js"></script>
- <script type="text/javascript" src="./table.json"></script>
- <script type="text/javascript">
- $.getJSON('table.json', function(data){
- alert(data);
- $(data.ItemisedBill).each(function(index,element){
- $('#tableData').append('<tr><td><input type="checkbox" name="chk"/></td><td>1</td><td><input type="text"/></td>');
- });
- });
- </script>
- </head>
- <body>
- <input type="button" value="Add Row" id="addRow" />
- <input type="button" value="Delete Row" id="deleteRow" />
- <table id="tableData" width="550px" border="1">
- <tr>
- <th>CheckBox</th>
- <th>Serial No.</th>
- <th>Item</th>
- <th>Price</th>
- <th>Quantity</th>
- <th>SubTotal</th>
- </tr>
- </table>
- </body>
- </html>
Json:- var ItemisedBill= [{
- "item":"name1",
- "price":"20",
- "quantity":2
- },
- {
- "item":"name2",
- "price":"30",
- "quantity":1
- },
- {
- "item":"name3",
- "price":"40",
- "quantity":3
- },
- {
- "item":"name4",
- "price":"14",
- "quantity":1
- },
- {
- "item":"name5",
- "price":"44",
- "quantity":4
- }
- ];
Thanks!
- 17-Apr-2013 04:56 AM
- Forum: Using jQuery
HiI want to delete the checked row when i am clicking on delete. For now it just removes the checkbox instead of whole text as well. Please let me know where i am wrong here.- <script type="text/javascript">
- $(document).ready(function(){
- $("#checkAll").click(function(){
- $("input").attr("checked", true);
- });
- $("#uncheck").click(function(){
- $("input").attr("checked", false);
- });
- $("#delete").click(function(){
- $("input:checkbox:checked").remove();
- });
- });
- </script>
- <body>
- <a href="#" id="checkAll">Check All</a>
- <a href="#" id="delete">Delete</a>
- <a href="#" id="uncheck">Uncheck All</a><br/>
- <input type="checkbox"/>My Name is abcdexcv<br/>
- <input type="checkbox"/>My Name is abcdexcv <br/>
- <input type="checkbox"/>My Name is abcdexcv <br/>
- <input type="checkbox"/>My Name is abcdexcv <br/>
- <input type="checkbox"/>My Name is abcdexcv <br/>
- <input type="checkbox"/>My Name is abcdexcv <br/>
- <input type="checkbox"/>My Name is abcdexcv <br/>
- </body>
- HiI have a ques here. Like if i have a big html. In that html, i have defined orders of the divs appearing in it.like:<div1><div2><div3>i have styled these divs thru css and have given css acc to their current position. But now if my data is dynamic now and i cant' say which div will come at which place. like it is kind of caraousel.how can i handle this? is there any way?
- Hi,i want to use filter in jquery but not gtting how to proceed with it. i have written below script.actually i want to do is, on click of .leftSelect i want to hide the current div and show previous. but only if parent is talkNowOptionsSkip i want to show some other div. this is not working which i have written below:
- $(".leftSelect").click(function(){
- $(this).closest('.closed').hide();
- $(this).closest('.pushLeftPressed').prev().show();
- });
- $(".talkNowOptionsSkip .leftSelect").click(function(){
- $(this).closest('.closed').hide();
- $(".talkNowOptionsCheck").show();
- });
- hi..in the below json i need to get the value of the id==8, but some better way. not thru data[1].children
- [
- {
- "id" : 1,
- "name" : "a",
- "children" : [
- {
- "id" : 2,
- "name" : "b",
- "children" : [
- {
- "id" : 3,
- "name" : "c",
- "children" : [
- {
- "id" : 4,
- "name" : "d",
- "children" : [
- {
- "id" : 5,
- "name" : "e",
- "children" : [
- {}
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "id" : 6,
- "name" : "f",
- "children" : [
- {
- "id" : 7,
- "name" : "g",
- "children" : [
- {
- "id" : 8,
- "name" : "h",
- "children" : [
- {
- "id" : 9,
- "name" : "i",
- "children" : [
- {
- "id" : 10,
- "name" : "j",
- "children" : [
- {}
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- Hi,Below is the scenario:
- <div4 class="abc">
- <div1 class="clickMeTalkNow">
- </div>
- </div>
- <div5 class="talkNowOptions">
- <div2 class="clickMeTalkNow">
- </div>
- </div>
- <div6 class="talkNowOptions">
- <div3 class="clickMeTalkNow">
- </div>
- </div>
on click of div1, div5 should open, on click of div2 ,div6 should open.something like this should be done. But i am nt getting exact way: should each() be used?- $(".clickMeTalkNow").click(function(){
- $(this).closest('.closed').hide();
- index = $('.clickMeTalkNow').index(this);
- $('#talkNowOptions').hide().eq(0).show();
- $('#talkNowOptions').hide().eq(1).show();
- });
- 28-Feb-2013 12:51 AM
- Forum: Using jQuery
Hi,my scenario is like,there is an image in a div:- <div class="leftSelect" >
- <img class="pushToLeft" src="./images/arrow-sched-left-none.png" alt="arrow-sched-left-none.png"/>
- </div>
now i have below scenario:
- <div1>
- <div class="leftSelect" >
- <img class="pushToLeft" src="./images/arrow-sched-left-none.png"alt="arrow-sched-left-none.png"/>
- </div>
- </div1>
- <div2>
- <div class="leftSelect" >
- <img class="pushToLeft" src="./images/arrow-sched-left-none.png"alt="arrow-sched-left-none.png"/>
- </div>
- </div2>
that clicking on this image should take me to the previous div and the clicked div should hide.how can i do this?i have written this script but it is not generalized:- $(".pushToLeft").click(function(){
- $(this).closest('.closed').hide();
- $("#showMe").show();
- });
- hi i have below situation:
- <div id="1">
- <img class="close">
- </div>
- <div id="2">
- <img class="close">
- </div>
like this multiple divs which have same image.now i want to write a jquery function, the divs which has these image, on clicking of the image, divs should hide.i want generalize function.. $(this) wont work.so what should i give here..- $(".close").click(function() {
- $(this).hide();
- });
- 26-Feb-2013 04:54 AM
- Forum: Using jQuery
i have below scenario:<div1> <div2> <div3>
all are clickable
<div1> click -> <div4> opens, <div5>should hide
<div2> click -> <div5> opens, <div4> should hide
now on clicking <div4>, <div6> opens everything else should hide.
i have written jquery for this, but in separate functons using all div ids separately.. i want to club this up and make a single function..
please tell me hw to do so..
thanks!
- Jake, u helped me that json part.but the css which i had written for that html, is not getting applied now. why is that?
- HI,i am not able to access the json data through query. Please let me know why.. i have tried so may ways.below is my script:
- $(document).ready(
- function () {
- $.getJSON("new.json",function(data)
- {
- var html = "";
- alert(data[0].content[1].css);
- for(var i=0,size=data.length;i<size;i++){
- alert("pallavi" +data.length);
- html += '<div class='+data[0].content[i].css+' id='+data[0].content[i].id+'></div>';
- }
- $('#clickCall').append(html);
- });
- });
below is my json:- [
- {
- {
- "content": [
- {
- "content": [
- {
- "content": [
- {
- "content": {
- "attrs": {
- "alt": "",
- "src": "../images/callnow.png"
- },
- "type": "img"
- }
- },
- {
- "content": {
- "content": {
- "text": "Call"
- },
- "css": "labelBox1",
- "type": "h3"
- }
- },
- {
- "content": {
- "content": {
- "text": "Talk us now or later. You can also share screens with an advisor."
- },
- "type": "p"
- }
- }
- ],
- "css": "box2",
- "id": "box2"
- },
- {
- "content": [
- {
- "content": {
- "attrs": {
- "alt": "",
- "src": "../common/images/service.jpg"
- },
- "css": "box3img",
- "type": "img"
- }
- },
- {
- "content": {
- "content": {
- "text": " Take in for Service"
- },
- "css": "labelBox2",
- "type": "h3"
- }
- },
- {
- "content": {
- "content": {
- "text": "Find a local Apple Authorized Service Provider or make an reservation at the Genius Bar. "
- },
- "type": "p"
- }
- }
- ],
- "css": "box3"
- },
- {
- "content": [
- {
- "content": {
- "attrs": {
- "alt": "",
- "src": "../images/icon_carrier.png"
- },
- "type": "img"
- }
- },
- {
- "content": {
- "content": {
- "text": "Contact Carrier"
- },
- "css": "labelBox3",
- "type": "h3"
- }
- },
- {
- "content": {
- "content": {
- "text": "Temper incididunt ut labore et dolore magna eliqua"
- },
- "type": "p"
- }
- }
- ],
- "css": "box4"
- }
- ],
- "css": "wrapperbox1",
- "id": "clickCall"
- }
- ]
- }
- }
- ]
Thanks!- hii am trying to create a plugin. there are two divs as below:
<div class="wrapperbox1" id="clickCall">
...something inside
</div>
<div class="clickShow" data-role="content" id="showMe">
...something inside
</div>
if i click on #clickCall, the #showMe should fade in. Initially, #showMe is display:none. i wrote the script for this. but now for plugin, i want to generalize this. coz it will be used widely in my app.
below is the plugin i tried to write but not wring:
(function($) {
$.fn.pal = function(options) {
return this.each(function() {
var clickcall = $(this);
clickcall.click(onClick);
});
};
function onClick() {
$(this).fadeIn('fast');
return false;
}
})(jQuery);
now if i call this plugin in my html like below:
<script>
$(document).ready(
function () {
$("#clickCall").pal('#showMe');
}
);
</script>
nothing is working. and i want to use options. but i am not able to understand how. please help.
- 14-Feb-2013 09:11 AM
- Forum: Developing jQuery Plugins
hii am trying to create a plugin. there are two divs as below:<div class="wrapperbox1" id="clickCall">
...something inside
</div>
<div class="clickShow" data-role="content" id="showMe">
...something inside
</div>
if i click on #clickCall, the #showMe should fade in. Initially, #showMe is display:none. i wrote the script for this. but now for plugin, i want to generalize this. coz it will be used widely in my app.
below is the plugin i tried to write but not wring:
(function($) {
$.fn.pal = function(options) {
return this.each(function() {
var clickcall = $(this);
clickcall.click(onClick);
});
};
function onClick() {
$(this).fadeIn('fast');
return false;
}
})(jQuery);
now if i call this plugin in my html like below:
<script>
$(document).ready(
function () {
$("#clickCall").pal('#showMe');
}
);
</script>
nothing is working. and i want to use options. but i am not able to understand how. please help.
- 07-Feb-2013 02:26 AM
- Forum: jQuery Mobile
below is my html:<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><title>pal.html</title><meta name="generator" content="BBEdit 16.0" /><link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /><script src="http://code.jquery.com/jquery-1.8.2.min.js"></script><script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script><link rel="stylesheet" href="navigation.css" /><script>$(document).on( "mobileinit", function() {$.mobile.defaultPageTransition = "slide";});$( document ).on( "pageinit", "[data-role='page'].demo-page", function() {$(document).on('expand', '.ui-collapsible', function() {$(this).children().next().hide();$(this).children().next().slideDown();});});</script><style>div.static{float: left;width: 31%;height: 80%;box-shadow: 2px 2px 2px rgba(121, 112, 107, 0.6);border: 1px solid rgba(121, 112, 107, 0.6);border-radius: 8px;margin-left: 100px;margin-right: 80px;margin-top: 20px;margin-bottom: 20px;border-image: initial;}div img{display:inline-block;}div ul{display:inline-block;}}</style></head><body><div data-role="page"><div data-role="content"><div data-role="collapsible" id="my-collapsible"><div class="static" id="click"><div><img src="Diamond Round.gif" alt="Diamond Round.gif" width="48" height="48"/><ul><li>Text1</li><li>Text2</li><li>Text3</li></ul><div></div></div></div></div><div data-role="page"><div data-role="content"><div id="slidedown" class="static" data-role="collapsible"><div><img src="Diamond Round.gif" alt="Diamond Round.gif" width="48" height="48"/><ul><li>Text1</li><li>Text2</li><li>Text3</li></ul><div></div></div></div></body></html>- HiNeed help on this one. I want to click on the box and then show a panel kind. But i am getting both divs. I am not able to get slidedown functionality.Please help.<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><title>pal.html</title><meta name="generator" content="BBEdit 16.0" /><link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /><script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script><script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script><script>$(document).on('expand', '.ui-collapsible', function() {$(this).children().next().hide();$(this).children().next().slideDown();});</script><style>div.static{width:348px;height:196px;border: 1px solid black;}div img{display:inline-block;}div ul{display:inline-block;}</style></head><body><div data-role="page"><div data-role="content"><div data-role="collapsible" id="my-collapsible"><div class="static" id="click"><div><img src="Diamond Round.gif" alt="Diamond Round.gif" width="48" height="48"/><ul><li>Text1</li><li>Text2</li><li>Text3</li></ul><div></div><div id="slidedown" class="static"><div><img src="Diamond Round.gif" alt="Diamond Round.gif" width="48" height="48"/><ul><li>Text1</li><li>Text2</li><li>Text3</li></ul><div></div></div></div></div></div></body></html>
- This is my below html. i want to implement Swipe gesture. But when i try to run in FF, i am getting Error loading. Please tell where im going wrong:
<!DOCTYPE html> <html> <head> <title>Test</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script> <script> $(function(){ $("#home").bind('swipeleft',function(event, ui){ $.mobile.changePage("../index.html", { transition: "slide" }); }); }); </script> </head> <body> <div data-role="page" id="home"> <div data-role="header"> <h1>Main Page</h1> </div> <div data-role="content"> <p>Slide finger left</p> </div> </div> </body> </html>- on click of a button i want to change the background color:$(document).ready(function(){$.ajax({type:'GET',url:'blue.json',dataType:'json',success:function(){$("button").click(function(){result = $("body").css("background-color",data.color);return result;});}});});this script is not working
- «Prev
- Next »
Moderate user : pallavi1811
© 2012 jQuery Foundation
Sponsored by
and others.



