Search Results

Search found 668 results on 27 pages for 'addclass'.

Page 15/27 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How to update a table row with save button using .ajax

    - by Randall
    I have a table which has one row and only one cell will be editable. I have accomplished this with the following code. $("td#effEndDate").click(function() { if (!$(this).hasClass("edit")) { var value = jQuery.trim($(this).html()); $(this).html("<input id=\"txtEdit\" type=\"text\" value=\"" + value + "\" />"); $(this).addClass("edit"); $("#txtEdit").focus(); } }); Now this is the part where i'm stuck. After the field is updated a save button must be clicked to call the proper .ajax method to update the database. But how can I compare the previous value to the current value on a button press? Since i'm not using the onblur property where I could have saved the old value and passed it to the update function.

    Read the article

  • Suppressing default anchor behavior in Safari with jQuery

    - by Macy Abbey
    Hello, I am attempting to prevent default anchor behavior in Safari using the jQuery library. Unfortunately, the standard techniques of returning false or using event.preventDefault() do not seem to be working in Safari. Could anyone help me with this issue? The code I'm working with is like this: $('#main .green-tabs a').live("click",function(event){ $('.green-tabs a').removeClass('active'); $(this).addClass('active'); event.preventDefault(); var that = this; return LolPage(event,that);});

    Read the article

  • Help with jQuery issue

    - by Espen Arnoy
    I have a simple page with a list if "items". I am allowing users to vote on these items, but I only want to allow the user to vote one per. item. Therefore i have made a jQuery script that adds a class to the items the user has voted on: if(! $(this).find(".item span").hasClass("voted")) { $(".item").hover(function() { $(this).find(".ratingbar").hide(); $(this).find(".votebar").show(); }, function() { $(this).find(".votebar").hide(); $(this).find(".ratingbar").show(); }); }; This is the script that prevents the user from voting again on the same item. $(".votebutton").click(function() { $("div#"+offerid).find(".item").addClass("voted"); } My problem is that this doesn´t work. When hovering an item, the hover function still runs even though the second script successfully added the class "voted" to the html. Why can this be?

    Read the article

  • Jquery click behaviour

    - by VP
    I'm developing a menu. This menu, will change the background image when you click on a link, as almost all menus does. if i click in one link from the menu, this link backgroun will change the color. My jquery script is: $(function() { $('#menu ul li').click(function() { $('#menu ul li').removeClass("current_page_item"); $(this).addClass("current_page_item"); //return false; }); }); today, with the "return false" commented, when i click on the link under "#menu ul li" it changes the background open the new page and the background is reseted. For sure, if i uncomment the return false, the background works fine but then i cannot open any link. So its looks like after that i open a new page, it reset the classes. How can i make it persistent?

    Read the article

  • How to get global variable in JQuery functions

    - by Tahir Akram
    I want to access my global javascript variable in JQuery methods. But I am unable to get it when I go to attach a click even to a div. As following. How can I do that? I mean do I need to rely on hidden fields for some state management? var divCount = 3; $(function() { //divCount is accessible here $("#sortable").sortable({ revert: true }); $("#new").click(function(){ if (divCount<7){ //divCount is not accessible here. why? and how? var thisCount = ++divCount; $("#draggable_"+thisCount).addClass("draggable"); } }); });

    Read the article

  • Jquery Text Variable

    - by Batfan
    I am trying to get jquery to pick up variable that I am defining and I'm having issues doing it. $.ajax({ url: "sitemap.php", cache: false, success: function(html){ $("#results").append(html); var $seriestitle = $("#define-title").text(); $('#results a:contains("$seriestitle")').addClass('current-series'); $('a:not(".current-series")').hide(); } }); This is the code I am using. You can view the page at the following URL: http://benjammindesigns.com/XML/details/1231.html There is a span on the page, with the ID 'define-title', that contains text. I am trying to pull the text from that span and use it as my variable. Any info is greatly appreciated.

    Read the article

  • How to convert this jquery code into simple javascript?

    - by metal-gear-solid
    How to convert this jquery code into simple javascript var $jt = jQuery.noConflict(); $jt(function($) { $jt('.tabs a').click(function(){ switch_tabs($jt(this)); return false; }); switch_tabs($jt('.defaulttab')); }); function switch_tabs(obj) { $jt('.tab-content').hide(); $jt('.tabs a').removeClass("selected"); var id = obj.attr("rel"); $jt('#'+id).show(); obj.addClass("selected"); } I want to use same effect without the need of jquery If i remove jquery and place simple javascript , functionality should remain

    Read the article

  • jQuery disable a link

    - by davebowker
    Hey, Anyone know how to disable a link in jquery WITHOUT using return false;? Specifically, what I'm trying to do is disable the link of an item, performing a click on it using jquery which triggers some stuff, then re-enabling that link so that if it's clicked again it works as default. Thanks. Dave UPDATE Here's the code. What it needs to do after the .expanded class has been applied is to re-enable the disabled link. $('ul li').click(function(e) { e.preventDefault(); $('ul').addClass('expanded'); $('ul.expanded').fadeIn(300); //return false; });`

    Read the article

  • Jquery draggable persistence either through mysql or saving cookie in the database?

    - by Muhammad Jehanzaib
    I want to know that how can I persist the divs dropped on a draggable. I have been trying since long but stuck at this point. Actually you can see the demo here. I have to save the user designed wedding floor. So whenever user logins next time he/ she is able to see the last design saved. The code is shown below: $(document).ready(function() { $("#droppable").droppable({ accept: '.draggable', drop: function(event, ui) { $(this).append($(ui.draggable).clone()); $("#droppable .draggable").addClass("objects"); $(".objects").removeClass("ui-draggable draggable"); $(".objects").draggable({ containment: 'parent', }); } }); $(".draggable").draggable({ helper: 'clone', tolerance: 'touch', cursor:'move' }); });

    Read the article

  • jquery Add and Remove Classes?

    - by Steven
    Hello, I need a script that adds a 2 to the end of a class in a div with the id .sideboxtopleft on clicking of a link with the id of posts. <script> $(".posts").click(function () { if ($('.sideboxtopleft').is('#sideboxtopleft2')) { $('.sideboxtopleft').removeClass('2'); } else{ $('.sideboxtopleft').addClass('2'); } }); </script> <div id="sideboxtopleft" class="sideboxtopleft"> <a href="#post" id="posts"><h3>RECENT POSTS <div id="arrow" class="arrow"></div></h3></a> </div> <div id="sideboxtopright" class="sideboxtopright"> <a href="#comments" id="comments"><h3>RECENT COMMENTS <div id="arrow" class="arrow2"></div></h3></a> </div> However it doesn't seem to want to work properly. Any help?

    Read the article

  • content show problem

    - by nonab
    I still fight with some jquery scripts:) With my first problem Jens Fahnenbruck helped me here: http://stackoverflow.com/questions/3021476/problem-with-hide-show-in-jquery thanks:) Now i added another fancy thing - jquery tabs Made a few modifications and it works like this: When you click on tab and it loads different main image for every tab. The problem is that i used $(document).ready(function() to handle those image changes. When i click any of 2x2 box images (on any tab) it will permanently change the image on the right and when i click on tabs it won't work like it did at the beginning. online example: http://rarelips.ayz.pl/testy/2/ code: <style type="text/css"> body { font: Arial, Helvetica, sans-serif normal 10px; margin: 0; padding: 0; } * {margin: 0; padding: 0;} img {border: none;} .container { height: 500px; width: 1000px; margin: -180px 0 0 -450px; top: 50%; left: 50%; position: absolute; } ul.thumb { float: left; list-style: none; margin: 0; padding: 10px; width: 360px; } ul.thumb li { margin: 0; padding: 5px; float: left; position: relative; width: 165px; height: 165px; } ul.thumb li img { width: 150px; height: 150px; border: 1px solid #ddd; padding: 10px; background: #f0f0f0; position: absolute; left: 0; top: 0; -ms-interpolation-mode: bicubic; } ul.thumb li img.hover { background:url(thumb_bg.png) no-repeat center center; border: none; } #main_view { float: left; padding: 9px 0; margin-left: -10px; } #main_view2 { float: left; padding: 9px 0; margin-left: -10px; } #main_view3 { float: left; padding: 9px 0; margin-left: -10px; } #main_view4 { float: left; padding: 9px 0; margin-left: -10px; } #wiecej { float: right; padding: 9px 0; margin-right: 20px; } .demo-show { width: 350px; margin: 1em .5em; } .demo-show h3 { margin: 0; padding: .25em; background: #bfcd93; border-top: 1px solid #386785; border-bottom: 1px solid #386785; } .demo-show div { padding: .5em .25em; } /* styl do tabek */ ul.tabs { margin: 0; padding: 0; float: left; list-style: none; height: 32px; /*--Set height of tabs--*/ border-bottom: 1px solid #999; border-left: 1px solid #999; width: 100%; } ul.tabs li { float: left; margin: 0; padding: 0; height: 31px; /*--Subtract 1px from the height of the unordered list--*/ line-height: 31px; /*--Vertically aligns the text within the tab--*/ border: 1px solid #999; border-left: none; margin-bottom: -1px; /*--Pull the list item down 1px--*/ overflow: hidden; position: relative; background: #e0e0e0; } ul.tabs li a { text-decoration: none; color: #000; display: block; font-size: 1.2em; padding: 0 20px; border: 1px solid #fff; /*--Gives the bevel look with a 1px white border inside the list item--*/ outline: none; } ul.tabs li a:hover { background: #ccc; } html ul.tabs li.active, html ul.tabs li.active a:hover { /*--Makes sure that the active tab does not listen to the hover properties--*/ background: #fff; border-bottom: 1px solid #fff; /*--Makes the active tab look like it's connected with its content--*/ } .tab_container { border: 1px solid #999; border-top: none; overflow: hidden; clear: both; float: left; width: 100%; background: #fff; } .tab_content { padding: 20px; font-size: 1.2em; } </style> <script type="text/javascript" src="index_pliki/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function(){ //Larger thumbnail preview $("ul.thumb li").hover(function() { $(this).css({'z-index' : '10'}); $(this).find('img').addClass("hover").stop() .animate({ marginTop: '-110px', marginLeft: '-110px', top: '50%', left: '50%', width: '200px', height: '200px', padding: '5px' }, 200); } , function() { $(this).css({'z-index' : '0'}); $(this).find('img').removeClass("hover").stop() .animate({ marginTop: '0', marginLeft: '0', top: '0', left: '0', width: '150px', height: '150px', padding: '10px' }, 400); }); //Swap Image on Click $("ul.thumb li a").click(function() { var mainImage = $(this).attr("href"); //Find Image Name $("#main_view img").attr({ src: mainImage }); $("#main_view2 img").attr({ src: mainImage }); $("#main_view3 img").attr({ src: mainImage }); $("#main_view4 img").attr({ src: mainImage }); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view img").attr({ src: './index_pliki/max1.jpg' }); $("#slickbox div[data-id=" + '01' + "].slickbox").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox div.slickbox').hide(); $("#slickbox div[data-id=" + dataID + "].slickbox").show('slow'); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view2 img").attr({ src: './index_pliki/max2.jpg' }); $("#slickbox2 div[data-id=" + '11' + "].slickbox2").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox2 div.slickbox2').hide(); $("#slickbox2 div[data-id=" + dataID + "].slickbox2").show('slow'); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view3 img").attr({ src: './index_pliki/max3.jpg' }); $("#slickbox3 div[data-id=" + '21' + "].slickbox3").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox3 div.slickbox3').hide(); $("#slickbox3 div[data-id=" + dataID + "].slickbox3").show('slow'); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view4 img").attr({ src: './index_pliki/max4.jpg' }); $("#slickbox4 div[data-id=" + '31' + "].slickbox4").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox4 div.slickbox4').hide(); $("#slickbox4 div[data-id=" + dataID + "].slickbox4").show('slow'); return false; }); }); </script> <script type ="text/javascript"> $(document).ready(function() { //When page loads... $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); }); </script> </head> <body> <div class="container"> <ul class="tabs"> <li><a href="#tab1">1</a></li> <li><a href="#tab2">2</a></li> <li><a href="#tab3">3</a></li> <li><a href="#tab4">4</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <!--Content--> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="01"><img src="./index_pliki/min1.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="02"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="03"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="04"><img src="./index_pliki/min4.jpg" alt="" /></a></li> </ul> <div id="main_view"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox"> <div id="someOtherID" class="slickbox" data-id="01" style="display: none;"> 1.1 </div> <div id="someOtherID" class="slickbox" data-id="02" style="display: none;"> 1.2 </div> <div id="someOtherID" class="slickbox" data-id="03" style="display: none;"> 1.3 </div> <div id="someOtherID" class="slickbox" data-id="04" style="display: none;"> 1.4 </div> <!-- <a href="#" id="slick-show"><img src="http://www.amptech.pl/images/more.jpg" alt="Zobacz wiecej" /></a> <a href="#" id="slick-hide"><img src="http://www.amptech.pl/images/online.jpg" alt="Zobacz wiecej" /></a>&nbsp;&nbsp; --> </div> </div> </div> <!-- tutaj wklejalem reszte --> <div id="tab2" class="tab_content"> <!--Content--> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="11"><img src="./index_pliki/min4.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="12"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="13"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="14"><img src="./index_pliki/min1.jpg" alt="" /></a></li> </ul> <div id="main_view2"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox2"> <div id="someOtherID" class="slickbox2" data-id="11" style="display: none;"> 2.1 </div> <div id="someOtherID" class="slickbox2" data-id="12" style="display: none;"> 2.2 </div> <div id="someOtherID" class="slickbox2" data-id="13" style="display: none;"> 2.3 </div> <div id="someOtherID" class="slickbox2" data-id="14" style="display: none;"> 2.4 </div> </div> </div> </div> <div id="tab3" class="tab_content"> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="21"><img src="./index_pliki/min4.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="22"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="23"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="24"><img src="./index_pliki/min1.jpg" alt="" /></a></li> </ul> <div id="main_view3"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox3"> <div id="someOtherID" class="slickbox3" data-id="21" style="display: none;"> 3.1 </div> <div id="someOtherID" class="slickbox3" data-id="22" style="display: none;"> 3.2 </div> <div id="someOtherID" class="slickbox3" data-id="23" style="display: none;"> 3.3 </div> <div id="someOtherID" class="slickbox3" data-id="24" style="display: none;"> 3.4 </div> </div> </div> </div> <div id="tab4" class="tab_content"> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="31"><img src="./index_pliki/min4.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="32"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="33"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="34"><img src="./index_pliki/min1.jpg" alt="" /></a></li> </ul> <div id="main_view4"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox4"> <div id="someOtherID" class="slickbox4" data-id="31" style="display: none;"> 4.1 </div> <div id="someOtherID" class="slickbox4" data-id="32" style="display: none;"> 4.2 </div> <div id="someOtherID" class="slickbox4" data-id="33" style="display: none;"> 4.3 </div> <div id="someOtherID" class="slickbox4" data-id="34" style="display: none;"> 4.4 </div> </div> </div> </div> </div> </div>

    Read the article

  • Jquery fade and swap an element when clicked which will also relate to an accordian menu

    - by Nik
    You will notice when you click posture 1 the description drops down and images appear on the right. Now when you click posture 2 or posture 3 the images and description change as they should. What I need to do now is - If posture 1 has been clicked and then posture 2 is clicked the posture 1 menu needs to close so that there is only one posture description visible at one time. If I could also make it so that if the current open posture item is clicked so that it closes and there are no open posture descriptions that there also no images displayed on the right. Finally is there a way to make sure only one set of animation images is running, because just say the user goes through all 26 options and they continue to run in the background it may get sluggish (thanks to Nick Craver for bringing that up). At this stage only posture 1, 2 and 3 are available. Ok finally some code - //Description drop-down boxes $(document).ready(function(){ //Hide (Collapse) the toggle containers on load $(".toggle_container").hide(); //Switch the "Open" and "Close" state per click $("h5.trigger").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); //Slide up and down on click $("h5.trigger").click(function(){ $(this).next(".toggle_container").slideToggle("slow"); }); }); //Images on the right fade in and out thanks to aSeptik $(document).ready(function(){ $('#section_Q_01,#section_Q_02,#section_Q_03').hide(); $(function() { $('h5.trigger a').click( function(e) { e.preventDefault(); var trigger_id = $(this).parent().attr('id'); //get id Q_## $('.current').removeClass('current').hide(); //add a class for easy access & hide $('#section_' + trigger_id).addClass('current').fadeIn(5000); //show clicked one }); }); }); //Fading pics $(document).ready(function(){ $('.pics').cycle({ fx: 'fade', speed: 2500 }); }); Description boxes - <h5 class="trigger" id="Q_01" ><a href="#">Posture 1 : Standing Deep Breathing :</a></h5> <div class="toggle_container" > <div class="block"> <span class="sc">Pranayama Series</span> <p class="bold">Benefits:</p> </div> </div> <h5 class="trigger" id="Q_02" ><a href="#">Posture 2 : Half Moon Pose With Hands To Feet Pose :</a></h5> <div class="toggle_container"> <div class="block"> <span class="sc">Ardha Chandrasana with Pada-Hastasana</span> <p class="bold">Benefits:</p> </div> </div> <h5 class="trigger" id="Q_03" ><a href="#">Posture 3 : Awkward Pose :</a></h5> <div class="toggle_container"> <div class="block"> <span class="sc">Utkatasana</span> <p class="bold">Benefits:</p> </div> </div> and the images on the right - <div id="section_Q_01" class="01"> <div class="pics"> <img src="../images/multi/poses/pose1/Pranayama._01.jpg"/> <img src="../images/multi/poses/pose1/Pranayama._02.jpg"/> <img src="../images/multi/poses/pose1/Pranayama._03.jpg"/> </div> </div> <div id="section_Q_02" class="02"> <div class="pics"> <img src="../images/multi/poses/pose2/Half_Moon_Pose_04.jpg" /> <img src="../images/multi/poses/pose2/Backward_Bending_05.jpg" /> <img src="../images/multi/poses/pose2/Hands_to_Feet_Pose_06.jpg" /> </div> </div> <div id="section_Q_03" class="03"> <div class="pics"> <img src="../images/multi/poses/pose3/Awkward_01.jpg" /> <img src="../images/multi/poses/pose3/Awkward_02.jpg" /> <img src="../images/multi/poses/pose3/Awkward_03.jpg" /> </div> </div> It would be a bonus if images faded out when another element is clicked... but not a big deal. Thanks for having a look

    Read the article

  • jQuery: How do I stop the page being displayed until it's been processed?

    - by Alistair Christie
    I'm using jQuery to modify the style of some pages in a large set of existing Web pages. This works, but the problem I have is that, for longer pages, the page is briefly visible with the wrong styles before the javascript kicks in and transforms the page. I'm using this kind of thing (the alerts are just to emphasize the problem): $(document).ready(function(){ ... alert("at this point the page is visible unstyled"); $('body').addClass('myStyle'); alert("now page looks like I want it to"); ... } How do I prevent the browser from displaying the page until $(document).ready(function() completes?

    Read the article

  • How to call angular javascript directive methods from the global scope

    - by user1659278
    I have a directive like the one of the examples from AngularJS, shown below. How can I call the toggle method from the global scope? I want to be able to toggle the zippy from some legacy code. myApp.directive('zippy', function(){ return { restrict: 'E', replace: true, transclude: true, scope: { title:'bind' }, template: '<div class="zippy">' + '<div class="title">{{title}}</div>' + '<div class="body" ng-transclude></div>' + '</div>', link: function(scope, element, attrs) { var title = angular.element(element.children()[0]), opened = true; title.bind('click', toggle); function toggle() { opened = !opened; element.removeClass(opened ? 'closed' : 'opened'); element.addClass(opened ? 'opened' : 'closed'); } toggle(); } } });

    Read the article

  • prepend href with same class

    - by user357034
    I have the following code on the my page... <a href="javascript:change_product_photo(2);"><img id="alternate_product_photo_2" style="border-color:#666666;" src="/v/vspfiles/photos/00-6189-2S.jpg" border="1"> Sometimes there could be more of the <a href="javascript:change_product_photo(4);"> and each one would have a higher index number 5, 6 ,7, etc. What I want to do is for each and every instance of the href with javascript:change_product_photo(x) (where x is the index) remove both "_" from the change_product_link but leave the (x) index My thought was to first add a class to all hrefs that contain javascript:change_product_photo and then modify all of the href;s with that class but I am lost on how to do this. Here is what I got so far... $("a[href*='javascript:change_product_photo']").addClass('link_fix'); Now I don't know how to remove the "_" from the url.

    Read the article

  • Work time in fullcalendar [Solution]

    - by Zozo
    Full calendar have no included options to work-time feature (selecting first and last rows in agenda view for any day - where in example company is not working). I managed something like that: viewDisplay: function(view){ $.ajax({ url: 'index.php?r=calendar/Default/worktime', dataType: 'json', success: function(data){ if(view.name=='agendaWeek') selectWorkTime(data, 30, 0, 24, false); else if(view.name=='agendaDay') selectDayWorkTime(data, 30, 0, 24, view, false); } }); } Where index.php?r=calendar/Default/worktime is php file returning json. It looks like that: $arr = array( 'mon' => array('8:00', '17:00'), 'tue' => array('9:00', '15:00'), 'wed' => array('9:30', '19:00'), 'thu' => array('6:00', '14:00'), 'fri' => array('0:00', '24:00'), 'sat' => array('9:00', '14:00'), 'sun' => array() ); foreach ($arr as &$day){ foreach($day as &$hour){ $tmp = explode(':', $hour); $hour = $tmp[0] * 3600 + $tmp[1] * 60; } } print json_encode($arr); and at the end, some functions using for counting and selecting work-time: function selectDayWorkTime(timeArray, slotMinutes, minTime, maxTime, viewObject, showAtHolidays){ var dayname; $('.fc-content').find('.fc-view-agendaWeek').find('.fc-agenda-body') .children('.fc-work-time').remove(); $('.fc-content').find('.fc-view-agendaDay') .find('.fc-work-time-day').removeClass('fc-work-time-day'); switch(viewObject.start.getDay()){ case 1: dayname='mon'; break; case 2: dayname='tue'; break; case 3: dayname='wed'; break; case 4: dayname='thu'; break; case 5: dayname='fri'; break; case 6: dayname='sat'; break; case 0: dayname='sun'; break; } for(var day in timeArray){ if(day == dayname){ if($('.fc-content').find('.fc-view-agendaDay').find('.fc-'+day).attr('class').search('fc-holiday') == -1 || showAtHolidays){ var startBefore = 0; var endBefore = timeArray[day][0] / (60 * slotMinutes) - (minTime * 60) / slotMinutes; var startAfter = timeArray[day][1] / (60 * slotMinutes) - (minTime * 60) / slotMinutes; var endAfter = (maxTime - minTime) * 60 / slotMinutes - 1; for(startBefore; startBefore < endBefore; startBefore++){ $('.fc-view-agendaDay').find('.fc-slot'+startBefore).find('div').addClass('fc-work-time-day'); } for(startAfter; startAfter <= endAfter; startAfter++){ $('.fc-view-agendaDay').find('.fc-slot'+startAfter).find('div').addClass('fc-work-time-day'); } } } } } function selectWorkTime(timeArray, slotMinutes, minTime, maxTime, showAtHolidays){ for(var day in timeArray){ var startBefore = 0; var endBefore = timeArray[day][0] / (60 * slotMinutes) - (minTime * 60) / slotMinutes; var startAfter = timeArray[day][1] / (60 * slotMinutes) - (minTime * 60) / slotMinutes; var endAfter = (maxTime - minTime) * 60 / slotMinutes - 1; if(startBefore > endBefore) endBefore = startBefore; if(startAfter > endAfter) startAfter = endAfter; try{ selectCell(startBefore, endBefore, 'fc-'+day, 'fc-work-time', false, showAtHolidays); selectCell(startAfter, endAfter, 'fc-'+day, 'fc-work-time', true, showAtHolidays); } catch(e){ continue; } } } function selectCell(startRowNo, endRowNo, collClass, cellClass, closeGap, showAtHolidays){ $('.fc-content').find('.fc-view-agendaWeek').find('.fc-agenda-body') .children('.'+cellClass+''+startRowNo+''+collClass).remove(); $('.fc-content').find('.fc-view-agendaDay') .find('.fc-work-time-day').removeClass('fc-work-time-day'); if($('.fc-content').find('.fc-view-agendaWeek').find('.'+collClass).attr('class').search('fc-holiday') == -1 || showAtHolidays){ var width = $('.fc-content').find('.fc-view-agendaWeek') .find('.'+collClass+':last').width(); var height = 0; if(closeGap && (startRowNo != endRowNo)){ height = $('.fc-content').find('.fc-view-agendaWeek') .find('.fc-slot'+ startRowNo).height(); } $('.fc-view-agendaWeek').find('.fc-agenda-body').prepend('<div class="'+cellClass+' ' + ''+cellClass+''+startRowNo+''+collClass+'"></div>'); $('.'+cellClass).width(width - 2); height += $('.fc-content').find('.fc-view-agendaWeek') .find('.fc-slot'+ endRowNo).position().top - $('.fc-content').find('.fc-view-agendaWeek') .find('.fc-slot'+ startRowNo).position().top; $('.'+cellClass+''+startRowNo+''+collClass).height(height); $('.'+cellClass+''+startRowNo+''+collClass) .css('margin-top', $('.fc-content').find('.fc-view-agendaWeek') .find('.fc-slot'+ startRowNo).position().top); $('.'+cellClass+''+startRowNo+''+collClass) .css('margin-left', $('.fc-content').find('.fc-view-agendaWeek') .find('.'+collClass+':last').offset().left - width / 2); } } Don't forget about CSS: .fc-work-time-day{ background-color: yellow; opacity: 0.3; filter: alpha(opacity=30); /* for IE */ } .fc-work-time{ position: absolute; background-color: yellow; z-index:10; margin: 0; padding: 0; text-align: left; z-index: 0; opacity: 0.3; filter: alpha(opacity=30); /* for IE */ } So, I've got some questions about - is the other way to make the same, but no using absolute div's in agendaWeek? And... How can I get in viewDisplay function actual slotMinutes, minTime and maxTime

    Read the article

  • Add class to .hover functionality on a specific class name - jQuery

    - by marcamillion
    So, throughout my entire document, I would like for every single time the user hovers over an element with a specific class name, I would like a class to be added. My CSS looks like this: .hotspot:hover, .hotspothover { border: 4px solid #fff; box-shadow: 0px 0px 20px #000; -webkit-box-shadow: 0px 0px 20px #000; -moz-box-shadow: 0px 0px 20px #000; z-index: 1; } Class name: "hotspot". I tried this, but it doesn't seem to work: $("#hotspot.hover #hotspothover").addClass("bubble bottom"); Thanks.

    Read the article

  • [jQuey] How select an element by class name, previously loaded in DOM

    - by Mattia
    I write a simple piece of code that creates a div and assign it a class name: $('#create_div').click( function() { div = $("<div>").addClass("myClass"); $("body").append(div); } ); Ok: after "create_div" button is fired the function appends the new div to body container. Now... : How to select the new element created ? How do I reach it? I have tried: $('.myClass').click( function() { // do something } ); but it doesn't works. Thanks for the help!

    Read the article

  • Change element class without using css animation

    - by Akshat
    I have a class with the following type of css animaton .cssanimation { -webkit-transition: 0.2s all ease-in-out -o-transition: 0.2s all ease-in-out -moz-transition: 0.2s all ease-in-out transition: 0.2s all ease-in-out .. some other changes in position } I have the div <div id="thediv"> ... </div> $('#thediv').addClass('cssanimation') //animates the object I do use this animation at some point but sometimes I'd like to add it without invoking the animation Does Jquery have a way in which I can add classes without invoking their css animations?

    Read the article

  • jQuery add class is not working

    - by user1269625
    Hey ya'll I have this code here and it suppose to add the class name "cboxElement" $(".wpcart_gallery a:first").addClass("cboxElement"); but it does not work. I have the proper Jquery file in my header, I have surrounded this in jQuery('document').ready(function($){......}); and it works for all my other Jquery but the add class call. here is what I am trying to add the class to... <div class="wpcart_gallery" style="text-align:center; padding-top:5px;"> <a class="thickbox" href="DSC_0037.jpg" rev="DSC_0037.jpg"></a> </div> Anybody know why this isnt working? I am new to jquery this is also in wordpress hence the jQuery('document')

    Read the article

  • jQuery effect on iframe parent document

    - by Jabes88
    Just wondering if anyone else has experienced this or knows why I am getting an error. I'm using javascript from within an iframe to call a parent dom element then use jQuery UI's effect core to shake it. Here is an example: $(document).ready(function(){ if ($("form").length>0) { $("form").submit(function(){ var oParentDoc = $(parent.document).find("div#element"); var action = $(this).attr("action"); var postdata = $(this).serialize(); $(oParentDoc).addClass("loading"); $.post(action,postdata,function(data){ $(oParentDoc).removeClass("loading").effect("shake",{"times":3,"distance":10},60); }); return false; }); } }); It works without the effect, but when I use an effect it gives me this error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMCSSStyleDeclaration.getPropertyValue]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" Thanks in advance for any insight :)

    Read the article

  • jquery to check when a someone starts typing in to a field

    - by Drew
    $('a#next').click(function() { var tags = $('input[name=tags]'); if(tags.val()==''){ tags.addClass('hightlight'); return false; }else{ tags.removeClass('hightlight'); $('#formcont').fadeIn('slow'); $('#next').hide('slow'); return false; } }); I would like the above code to fire the fadeIn as soon as somebody starts typing into the tags input. Can somebody tell me the correct way to do this or point me in the right direction? Thanks in advance EDIT here is the code to do it: $('input#tags').keypress(function() { $('#formcont').fadeIn('slow'); $('#next').hide('slow'); }); The only problem I've found is that my cursor no longer shows up in the text box. What am I doing wrong?

    Read the article

  • plugin instancing

    - by Hailwood
    Hi guys, I am making a jquery tagging plugin. I have an issue that, When there is multiple instances of the plugin on the page, if you click on any <ul> that the plugin has been called on it will put focus on the <input /> in the last <ul> that the plugin has been called on. Why is this any how can I fix it. $.widget("ui.tagit", { // default options options: { tagSource: [], triggerKeys: ['enter', 'space', 'comma', 'tab'], initialTags: [], minLength: 1 }, //private variables _vars: { lastKey: null, element: null, input: null, tags: [] }, _keys: { backspace: 8, enter: 13, space: 32, comma: 44, tab: 9 }, //initialization function _create: function() { var instance = this; //store reference to the ul this._vars.element = this.element; //add class "tagit" for theming this._vars.element.addClass("tagit"); //add any initial tags added through html to the array this._vars.element.children('li').each(function() { instance.options.initialTags.push($(this).text()); }); //add the html input this._vars.element.html('<li class="tagit-new"><input class="tagit-input" type="text" /></li>'); this._vars.input = this._vars.element.find(".tagit-input"); //setup click handler $(this._vars.element).click(function(e) { if (e.target.tagName == 'A') { // Removes a tag when the little 'x' is clicked. $(e.target).parent().remove(); instance._popTag(); } else { instance._vars.input.focus(); } }); //setup autcomplete handler this.options.appendTo = this._vars.element; this.options.source = this.options.tagSource; this.options.select = function(event, ui) { instance._addTag(ui.item.value); return false; } this._vars.input.autocomplete(this.options); //setup keydown handler this._vars.input.keydown(function(e) { var lastLi = instance._vars.element.children(".tagit-choice:last"); if (e.which == instance._keys.backspace) return instance._backspace(lastLi); if (instance._isInitKey(e.which)) { event.preventDefault(); if ($(this).val().length >= instance.options.minLength) instance._addTag($(this).val()); } if (lastLi.hasClass('selected')) lastLi.removeClass('selected'); instance._vars.lastKey = e.which; }); //setup blur handler this._vars.input.blur(function() { instance._addTag($(this).val()); $(this).val(''); }); //define missing trim function for strings String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); }; this._initialTags(); }, _popTag: function() { return this._vars.tags.pop(); } , _addTag: function(value) { this._vars.input.val(""); value = value.replace(/,+$/, ""); value = value.trim(); if (value == "" || this._exists(value)) return false; var tag = ""; tag = '<li class="tagit-choice">' + value + '<a class="tagit-close">x</a></li>'; $(tag).insertBefore(this._vars.input.parent()); this._vars.input.val(""); this._vars.tags.push(value); } , _exists: function(value) { if (this._vars.tags.length == 0 || $.inArray(value, this._vars.tags) == -1) return false; return true; } , _isInitKey : function(keyCode) { var keyName = ""; for (var key in this._keys) if (this._keys[key] == keyCode) keyName = key if ($.inArray(keyName, this.options.triggerKeys) != -1) return true; return false; } , _backspace: function(li) { if (this._vars.input.val() == "") { // When backspace is pressed, the last tag is deleted. if (this._vars.lastKey == this._keys.backspace) { this._popTag(); li.remove(); this._vars.lastKey = null; } else { li.addClass('selected'); this._vars.lastKey = this._keys.backspace; } } return true; } , _initialTags: function() { if (this.options.initialTags.length != 0) { for (var i in this.options.initialTags) if (!this._exists(this.options.initialTags[i])) this._addTag(this.options.initialTags[i]); } } , tags: function() { return this._vars.tags; } , destroy: function() { $.Widget.prototype.destroy.apply(this, arguments); // default destroy this._vars['tags'] = []; } }) ;

    Read the article

  • Drop Down Problems

    - by user351260
    Hello, I am trying to create a drop down list i have it working but not fully, using this code $(document).ready(function(){ $("#zone-bar li em").hover(function() { var hidden = $(this).parents("li").children("ul").is(":hidden"); $("#zone-bar>ul>li>ul").hide() $("#zone-bar>ul>li>a").removeClass(); if (hidden) { $(this) .parents("li").children("ul").toggle() .parents("li").children("a").addClass("zoneCur"); } }); }); I am managed to make it work so on hover the drop down list will appear which is does but when you move to select one of the items from the drop down list the drop down list closes any help to fix this would be great thanks. It works if i put it to onclick but then you have to click the arrow to close it again the website is doctorwhohd.com and it currently on onclick thanks

    Read the article

  • how best to set text alignment in a table

    - by ericslaw
    Does anyone know of a jquery plugin or snippet that will auto-text-align cells in a table based on content? Specifically, all table cells would be right justified unless there is a visible non-number related character in the cell, then it would be left justified. I'd like to use something like this regular expression to identify non-number related characters in a cell: /[^0-9% +-()]/ Is there a real simple way to accomplish this? I would think something like this: $("td:contains('[^0-9% +-()]')").addClass("left"); would do the trick, but I don't think 'contains' can take a regular expression.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >