jquery Programming Glossary: px
How to individually target multiple dropdowns in CSS for Dropkick Plug-in http://stackoverflow.com/questions/11769888/how-to-individually-target-multiple-dropdowns-in-css-for-dropkick-plug-in up to How to get the output in relative units instead px by modifying this jQuery plugin of making custom style dropdown..
jQuery: How to position one element relative to another? http://stackoverflow.com/questions/158070/jquery-how-to-position-one-element-relative-to-another the placeholder #menu .css position absolute top pos.top px left pos.left width px .show But it doesn't work This will work.. .css position absolute top pos.top px left pos.left width px .show But it doesn't work This will work as long as the menu..
How can I position an element next to user text selection? http://stackoverflow.com/questions/1589721/how-can-i-position-an-element-next-to-user-text-selection div selectionEl.style.border solid darkblue 1px selectionEl.style.backgroundColor lightgoldenrodyellow selectionEl.innerHTML.. your jQuery stuff in here selectionEl.style.left left px selectionEl.style.top top px markerEl.parentNode.removeChild.. selectionEl.style.left left px selectionEl.style.top top px markerEl.parentNode.removeChild markerEl share improve this..
Using jQuery to center a DIV on the screen http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen 0 window .height this .outerHeight 2 window .scrollTop px this.css left Math.max 0 window .width this .outerWidth 2 .. 0 window .width this .outerWidth 2 window .scrollLeft px return this Now we can just write element .center Demo http..
jQuery UI Dialog Button Icons http://stackoverflow.com/questions/2525524/jquery-ui-dialog-button-icons ' btnDelete.prepend ' span style float left margin top 5px class ui icon ui icon trash span ' btnDelete.width btnDelete.width.. down so it looks like it's centred vertically. Adding 25 px to the button's width keeps the button text from wrapping onto..
What is the simplest jQuery way to have a 'position:fixed' (always at top) div? http://stackoverflow.com/questions/257250/what-is-the-simplest-jquery-way-to-have-a-positionfixed-always-at-top-div .scroll function '#myElement' .css 'top' this .scrollTop px As pointed out in the comments below it's not recommended to..
Can you use CSS3 to transition from height:0 to the variable height of content? http://stackoverflow.com/questions/3149419/can-you-use-css3-to-transition-from-height0-to-the-variable-height-of-content transition height .5s height 0 overflow hidden outline 1px solid red style script type 'text javascript' function growDiv.. growDiv.style.height wrapper.clientHeight px script input type button onclick growDiv value grow div id.. transition height .5s height 0 overflow hidden outline 1px solid red style script type 'text javascript' function growDiv..
hide scrollbar while still able to scroll with mouse/keyboard [duplicate] http://stackoverflow.com/questions/3293650/hide-scrollbar-while-still-able-to-scroll-with-mouse-keyboard document.getElementById wrapper .style.width textareaWidth px See demo or complete HOWTO . Update you can use the same principle..
jquery find element at a particular position http://stackoverflow.com/questions/3942776/jquery-find-element-at-a-particular-position example select the element that is located left 100 150 px top 200 280px Thank you guys javascript jquery share improve.. the element that is located left 100 150 px top 200 280px Thank you guys javascript jquery share improve this question..
Making custom right-click context menus for my web-app http://stackoverflow.com/questions/4495626/making-custom-right-click-context-menus-for-my-web-app menu' Custom menu div .appendTo body .css top event.pageY px left event.pageX px Here you could bind the event handler to.. .appendTo body .css top event.pageY px left event.pageX px Here you could bind the event handler to any selector that you.. 1000 position absolute background color #C0C0C0 border 1px solid black padding 2px The important thing with the CSS is..
how to move a div with arrow keys http://stackoverflow.com/questions/4950575/how-to-move-a-div-with-arrow-keys div id box div div CSS #pane position relative width 300px height 300px border 2px solid red #box position absolute top.. div div CSS #pane position relative width 300px height 300px border 2px solid red #box position absolute top 140px left 140px.. #pane position relative width 300px height 300px border 2px solid red #box position absolute top 140px left 140px width..
jquery animate background-position firefox http://stackoverflow.com/questions/5518834/jquery-animate-background-position-firefox 0 action 1 image .animate backgroundPositionX ' ' jump 'px' duration time easing animation setTimeout anim time function.. 0 action 1 image .animate backgroundPositionX ' ' jump 'px' duration time easing animation setTimeout anim time function.. it also does nothing image .animate backgroundPosition '500px 0px' 800 jquery jquery animate background position share..
jQuery 1.6: backgroundPosition vs backgroundPositionX and FF4 compatibility http://stackoverflow.com/questions/6322347/jquery-1-6-backgroundposition-vs-backgroundpositionx-and-ff4-compatibility I found out that the use of animate backgroundPosition '10px 0px' needed to be changed to animate backgroundPositionX '10px'.. out that the use of animate backgroundPosition '10px 0px' needed to be changed to animate backgroundPositionX '10px'.. needed to be changed to animate backgroundPositionX '10px' backgroundPositionY '0px' as only properties with one parameter..
Creating templated/persistant header/footer template in jQuery Mobile and PhoneGap http://stackoverflow.com/questions/9152446/creating-templated-persistant-header-footer-template-in-jquery-mobile-and-phoneg fixed fade ui fixed inline role contentinfo style top 58px And the JS .live 'pageinit' function event displayFooter function.. The position of the menu which is set using css top ...px is sometimes not correct and moves itself to the correct position.. Also it's easy to make a method that calculates the top in px for the #footer if the position caused by the top value by JQM..
make iframe height dynamic based on content inside- JQUERY/Javascript http://stackoverflow.com/questions/9162933/make-iframe-height-dynamic-based-on-content-inside-jquery-javascript based on content inside JQUERY Javascript loading an aspx web page in an iframe . The content in the Iframe can be of.. the 'Iframe' is contained. 'body' the body tag of the aspx in the iframe. This script is attached to the iframe content... iFrameID.contentWindow.document.body.scrollHeight px script Then on the IFRAME tag you hook up the handler like..
How to individually target multiple dropdowns in CSS for Dropkick Plug-in http://stackoverflow.com/questions/11769888/how-to-individually-target-multiple-dropdowns-in-css-for-dropkick-plug-in target multiple dropdowns in CSS for Dropkick Plug in Follow up to How to get the output in relative units instead px by modifying this jQuery plugin of making custom style dropdown Referring to http jamielottering.github.com DropKick Given..
jQuery: How to position one element relative to another? http://stackoverflow.com/questions/158070/jquery-how-to-position-one-element-relative-to-another var width this .outerWidth show the menu directly over the placeholder #menu .css position absolute top pos.top px left pos.left width px .show But it doesn't work This will work as long as the menu and the placeholder have the same offset.. show the menu directly over the placeholder #menu .css position absolute top pos.top px left pos.left width px .show But it doesn't work This will work as long as the menu and the placeholder have the same offset parent. If they don't..
How can I position an element next to user text selection? http://stackoverflow.com/questions/1589721/how-can-i-position-an-element-next-to-user-text-selection next to the selection if selectionEl selectionEl document.createElement div selectionEl.style.border solid darkblue 1px selectionEl.style.backgroundColor lightgoldenrodyellow selectionEl.innerHTML lt selection selectionEl.style.position..
Using jQuery to center a DIV on the screen http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen function this.css position absolute this.css top Math.max 0 window .height this .outerHeight 2 window .scrollTop px this.css left Math.max 0 window .width this .outerWidth 2 window .scrollLeft px return this Now we can just write element.. .outerHeight 2 window .scrollTop px this.css left Math.max 0 window .width this .outerWidth 2 window .scrollLeft px return this Now we can just write element .center Demo http jsfiddle.net DerekL GbDw9 with added parameter share improve..
jQuery UI Dialog Button Icons http://stackoverflow.com/questions/2525524/jquery-ui-dialog-button-icons '.ui dialog buttonpane' .find 'button contains Delete ' btnDelete.prepend ' span style float left margin top 5px class ui icon ui icon trash span ' btnDelete.width btnDelete.width 25 Adding some top margin pushes the icon down so it.. btnDelete.width 25 Adding some top margin pushes the icon down so it looks like it's centred vertically. Adding 25 px to the button's width keeps the button text from wrapping onto a second line. jquery jquery ui jquery ui dialog share..
What is the simplest jQuery way to have a 'position:fixed' (always at top) div? http://stackoverflow.com/questions/257250/what-is-the-simplest-jquery-way-to-have-a-positionfixed-always-at-top-div and moves the element down as far as you've scrolled. window .scroll function '#myElement' .css 'top' this .scrollTop px As pointed out in the comments below it's not recommended to attach events to the scroll event as the user scrolls it fires..
Can you use CSS3 to transition from height:0 to the variable height of content? http://stackoverflow.com/questions/3149419/can-you-use-css3-to-transition-from-height0-to-the-variable-height-of-content .5s o transition height .5s webkit transition height .5s transition height .5s height 0 overflow hidden outline 1px solid red style script type 'text javascript' function growDiv var growDiv document.getElementById 'grow' if growDiv.clientHeight.. 0 else var wrapper document.querySelector '.measuringWrapper' growDiv.style.height wrapper.clientHeight px script input type button onclick growDiv value grow div id 'grow' div class 'measuringWrapper' div The contents of my div... .5s o transition height .5s webkit transition height .5s transition height .5s height 0 overflow hidden outline 1px solid red style script type 'text javascript' function growDiv var growDiv document.getElementById 'grow' if growDiv.clientHeight..
hide scrollbar while still able to scroll with mouse/keyboard [duplicate] http://stackoverflow.com/questions/3293650/hide-scrollbar-while-still-able-to-scroll-with-mouse-keyboard our wrapper equals width of the inner part of the textarea document.getElementById wrapper .style.width textareaWidth px See demo or complete HOWTO . Update you can use the same principle to create scrollable div without scrollbar demo . share..
jquery find element at a particular position http://stackoverflow.com/questions/3942776/jquery-find-element-at-a-particular-position I could select and element located in a range of positions for example select the element that is located left 100 150 px top 200 280px Thank you guys javascript jquery share improve this question You are looking for the .elementFromPoint.. and element located in a range of positions for example select the element that is located left 100 150 px top 200 280px Thank you guys javascript jquery share improve this question You are looking for the .elementFromPoint Javascript DOM..
Making custom right-click context menus for my web-app http://stackoverflow.com/questions/4495626/making-custom-right-click-context-menus-for-my-web-app function event event.preventDefault div class 'custom menu' Custom menu div .appendTo body .css top event.pageY px left event.pageX px Here you could bind the event handler to any selector that you want to show a menu for. I've chosen.. event.preventDefault div class 'custom menu' Custom menu div .appendTo body .css top event.pageY px left event.pageX px Here you could bind the event handler to any selector that you want to show a menu for. I've chosen the entire document... 3 CSS to control the position of the menu .custom menu z index 1000 position absolute background color #C0C0C0 border 1px solid black padding 2px The important thing with the CSS is to include the z index and position absolute It wouldn't be..
how to move a div with arrow keys http://stackoverflow.com/questions/4950575/how-to-move-a-div-with-arrow-keys events div share improve this question HTML div id pane div id box div div CSS #pane position relative width 300px height 300px border 2px solid red #box position absolute top 140px left 140px width 20px height 20px background color black.. share improve this question HTML div id pane div id box div div CSS #pane position relative width 300px height 300px border 2px solid red #box position absolute top 140px left 140px width 20px height 20px background color black JavaScript.. this question HTML div id pane div id box div div CSS #pane position relative width 300px height 300px border 2px solid red #box position absolute top 140px left 140px width 20px height 20px background color black JavaScript var pane..
jquery animate background-position firefox http://stackoverflow.com/questions/5518834/jquery-animate-background-position-firefox event if event.keyCode '39' left function left if action 0 action 1 image .animate backgroundPositionX ' ' jump 'px' duration time easing animation setTimeout anim time function right if action 0 action 1 image .animate backgroundPositionX.. animation setTimeout anim time function right if action 0 action 1 image .animate backgroundPositionX ' ' jump 'px' duration time easing animation setTimeout anim time function anim action 0 I also tried this but it also does nothing.. anim time function anim action 0 I also tried this but it also does nothing image .animate backgroundPosition '500px 0px' 800 jquery jquery animate background position share improve this question here try this for background animation..
jQuery 1.6: backgroundPosition vs backgroundPositionX and FF4 compatibility http://stackoverflow.com/questions/6322347/jquery-1-6-backgroundposition-vs-backgroundpositionx-and-ff4-compatibility questions 6032538 to work above jQuery 1.4.4 I found out that the use of animate backgroundPosition '10px 0px' needed to be changed to animate backgroundPositionX '10px' backgroundPositionY '0px' as only properties with one parameter.. questions 6032538 to work above jQuery 1.4.4 I found out that the use of animate backgroundPosition '10px 0px' needed to be changed to animate backgroundPositionX '10px' backgroundPositionY '0px' as only properties with one parameter.. found out that the use of animate backgroundPosition '10px 0px' needed to be changed to animate backgroundPositionX '10px' backgroundPositionY '0px' as only properties with one parameter should be used. So far this makes sense but wait.. while..
Creating templated/persistant header/footer template in jQuery Mobile and PhoneGap http://stackoverflow.com/questions/9152446/creating-templated-persistant-header-footer-template-in-jquery-mobile-and-phoneg mainFooter data role footer class ui footer ui bar a ui footer fixed fade ui fixed inline role contentinfo style top 58px And the JS .live 'pageinit' function event displayFooter function displayFooter '#mainFooter' .html ' div data role navbar.. the JQM styling correct however there's still one little bug. The position of the menu which is set using css top ...px is sometimes not correct and moves itself to the correct position after the first tap. Really close though Edit By setting..
make iframe height dynamic based on content inside- JQUERY/Javascript http://stackoverflow.com/questions/9162933/make-iframe-height-dynamic-based-on-content-inside-jquery-javascript iframe height dynamic based on content inside JQUERY Javascript loading an aspx web page in an iframe . The content in the Iframe can be of more height than the iframe's height. The iframe should not.. .height body .height 50 where 'TB_window' is the div in which the 'Iframe' is contained. 'body' the body tag of the aspx in the iframe. This script is attached to the iframe content. i am getting the TB_window element from the parent page. while.. it first then I make it again iFrameID.height iFrameID.height iFrameID.contentWindow.document.body.scrollHeight px script Then on the IFRAME tag you hook up the handler like this iframe id idIframe onload iframeLoaded ... I had a situation..
|