public marks

PUBLIC MARKS from decembre with tags javascript & exemple

2017

jQUERY - JAVASCRIPT - jQuery udraggable Plugin

jquery.udraggable.js This plugin provides an API similar to jQueryUI's draggable but with support for unified mouse and touch events. It builds on Michael S. Mikowski's jquery.event.ue unified event plugin.

html - Draggable div without jQuery UI - Stack Overflow

(via)
Here's another updated code: $(document).ready(function() { var $dragging = null; $('body').on("mousedown", "div", function(e) { $(this).attr('unselectable', 'on').addClass('draggable'); var el_w = $('.draggable').outerWidth(), el_h = $('.draggable').outerHeight(); $('body').on("mousemove", function(e) { if ($dragging) { $dragging.offset({ top: e.pageY - el_h / 2, left: e.pageX - el_w / 2 }); } }); $dragging = $(e.target); }).on("mouseup", ".draggable", function(e) { $dragging = null; $(this).removeAttr('unselectable').removeClass('draggable'); }); });​

jQUERY -JqueryUI - DRAG - JqueryUI Draggable

(via)
$ (selector, context).draggable (options) Method The draggable (options) method declares that an HTML element can be moved in the HTML page. The options parameter is an object that specifies the behavior of the elements involved. Syntax $(selector, context).draggable(options); You can provide one or more options at a time using Javascript object. If there are more than one options to be provided then you will separate them using a comma as follows − $(selector, context).draggable({option1: value1, option2: value2..... });

2015

jQuery - TUTO - Le sélecteur jQuery - débuter en jQuery

$ : le sélecteur raccourci __ Encore une petite précision : dans mon extrait de code ci-dessus, vous voyez que j'ai ajouté un paramètre $ pour ma fonction anonyme, et que j'ai ensuite utilisé $() à la place de jQuery().__En fait, $() est un alias de la fonction jQuery() (un autre nom pour la même fonction), on l'utilise plus souvent que jQuery(), tout simplement parce que c'est plus court à écrire ! __ Le seul problème est que d'autres framework javascript (Mootools nottament) utilisent également $ comme raccourci, du coup si vous utilisez plusieurs frameworks sur la même page, il y aura des conflits. ___ Heureusement, jQuery propose un mode noConflict(). Dans ce mode, le raccourci $ n'est pas créé pour éviter les problèmes. Le mode noConflict est par exemple activé par défaut dans Wordpress, donc $ ne marche pas et il faut donc se rabattre sur jQuery() à la place, la loose -_-'. __ L'astuce que j'ai utilisée me permet d'utiliser $ comme raccourci SEULEMENT à l'intérieur de ma fonction anonyme. Comme ça, même sous Wordpress où le mode noConflict est activé, je pourrais utiliser $ à l'intérieur de mon jQuery(document).ready.

jQuery - TUTO - Iframe - Créer un élément HTML dans le DOM avec jQuery

Le sélecteur jQuery est la plupart du temps utilisé pour sélectionner des éléments existant dans le DOM, via une règle CSS. Mais le sélecteur peut aussi créer de nouveaux éléments HTML de manière extrêmement simple ! Voici un petit exemple très simple qui créé un élément div , écrit "Salut !" à l'intérieur, puis enfin ajoute cet élément à la fin de la page web (en l'ajoutant à la fin body) :

JQuery - DEMO - arrays - JQuery .each() backwards - Stack Overflow

Here are different options for this: You can use this: $($("ul > li").get().reverse()).each(function (i) { $(this).text( 'Item ' + (++i)); }); ===or==== $($(".block-item").get().reverse()).each(function (i) { $(this).text(++i); });

SCRIPT - Floating Layer At Cursor Position

This post shows how to implement layers that will display content over existing content just below and to the right of the cursor position

2014

javascript - Use Greasemonkey to replace links, to images, with images? - Stack Overflow

Replacing links to images is not too hard to do. However, I recommend that you keep the link but display the picture inside it. This is so you can click through if something goes wrong. For example, that sample page you gave has most of the linked images on a dead site. Other linked images only look like they point to images or might be blocked for "hot linking". To make the code robust and easy, we use jQuery and waitForKeyElements. Here is a complete working script that delinks the payload image-links on that sample site:

decembre's TAGS related to tag javascript

ajax +   animation +   api +   article +   audio +   bibliotheque +   blog +   bookmarklet +   browser +   carte +   checkbox +   chrome +   code +   comment +   convert +   css +   data +   delete +   demo +   design +   dev +   development +   documentation +   dom +   editeur +   editor +   example +   exemple +   extension +   fichier +   fiddle +   firebug +   firefox +   flash +   flickr +   FlickrSurf+ +   format +   forum +   free +   function +   google +   greasemonkey +   guide +   hack +   howto +   htlm +   html +   html5 +   image +   infinite-scroll +   interactif +   interface +   java +   jQuery +   json +   library +   link +   liste +   maps +   ocr +   online +   opensource +   outil +   php +   player +   plugin +   programmation +   reference +   regex +   Responsive +   ressource +   script +   scroll +   scrollbar +   selector +   site +   stackoverflow +   tag +   test +   text +   tips +   tool +   transform +   tuto +   tutorial +   tutoriel +   user +   userscript +   userstyle +   utilitaire +   video +   web +   web2.0 +   webdesign +   webdev +   wysiwyg +   xhtml +   xml +   xpi +   xul +