GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   little jquery help (https://gfy.com/showthread.php?t=959480)

fris 03-21-2010 08:14 AM

little jquery help
 
how would i do this in jquery

Code:

onmouseout="reducethumb(1); return false;"

onmouseover="expandthumb(1, 657, 623);"


ScriptWorkz 03-21-2010 08:43 AM

Code:

$(".selector").hover(function() { reducethumb(1); return false; }, function () {
expandthumb(1, 657, 623);
});


fris 03-21-2010 08:46 AM

how bout for each one. i have this

Code:

<img src="full.png" alt="" class="grow" id="screen1"
onmouseout="reducethumb(1); return false;" width="240" height="227" />
<img src="thumb.png" alt="" class="shrink" id="thumb1"
onmouseover="expandthumb(1, 657, 623);">


fris 03-21-2010 10:50 AM

bump for scriptworkz

borked 03-21-2010 11:37 AM

Why are you trying to use jQuery for this when simple javascript works fine?
A clumsy, but functional way is to use the .attr handle to pass variable in the <img> tag to jQuery. eg

Code:

<script type='text/javascript'>
$(document).ready(function(){
$(".img_thumb").mouseover(
        function () {
                var var1 = $(".img_thumb").attr('var1');
                var var2 = $(".img_thumb").attr('var2');
                var var3 = $(".img_thumb").attr('var3');
                expandthumb(var1, var2, var3);
        });
});

</script>

<img class="img_thumb" src="thumb.png" var1="1" var2="657" var3="623" width="300" height="50" />

Hope this sets you down the right path

ScriptWorkz 03-21-2010 12:00 PM

Quote:

<img src="full.png" alt="" class="grow" id="screen1"
onmouseout="reducethumb(1); return false;" width="240" height="227" />
<img src="thumb.png" alt="" class="shrink" id="thumb1"
onmouseover="expandthumb(1, 657, 623);">
to do each one you'd just have to apply it to each one,
Code:

$(".grow").hover(function() { }, function() {
 reducethumb(1);
});

$(".shrink").hover(function() {
  expandthumb(1, 657, 623);
}, function() {});

first chunk adds reducethumb to mouse out on all images w/ class of grow, second one adds expand thumb to all images w/ class 'shrink'. You can fill out the empty functions in each to do something on mouseover / mouseout respectively.


All times are GMT -7. The time now is 11:22 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123