News:

Wondering if this will always be free?  See why free is better.

Main Menu

Mousewheel for Resize Image

Started by Hoochie Coochie Man, May 10, 2008, 11:46:50 AM

Previous topic - Next topic

Hoochie Coochie Man

Mousewheel for Resize Image (a little tip)

Demo

In Subs.php
Find:
'content' => '<img src="$1" alt="" border="0" />',

Change:
'content' => '<img id="hcm1" src="$1" alt="" border="0" />',

In index.tempalte.php
Find:
</head>

<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/mootools.js"></script>

<script type="text/javascript">
window.addEvent("domready", function(){
Element.Events.extend({
"wheelup": {
type: Element.Events.mousewheel.type,
map: function(event){
event = new Event(event);
if (event.wheel >= 0) this.fireEvent("wheelup", event)
}
},

"wheeldown": {
type: Element.Events.mousewheel.type,
map: function(event){
event = new Event(event);
if (event.wheel <= 0) this.fireEvent("wheeldown", event)
}
}
});

/* Mousewheel by Hoochie Coochie Man */
$("hcm1").addEvents({
"wheelup": function(e) {
e = new Event(e).stop();

this.width *= 1.1;
this.height *= 1.1;
},

"wheeldown": function(e) {
e = new Event(e).stop();

if (this.width-30 >= 30) {
this.width /= 1.1;
this.height /= 1.1;
}
}
});

});
</script>


And finaly put the attached .js file to your theme file.
İnadına SMF 1.1.X

L.G.S

Looks good. Quite a bit of code though, will it slow down pages with quite a few images?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


H

* H moves to Tips and Tricks :)

mootools is AFAIK a whole framework. Perhaps the needed function(s) could be separated?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Shark-Time



Providing Cheapest Offshore Hosting as low as 5$/year.
MoneyBookers | AlertPay
Pm Me


FlixyaFriend

samsung ue46c8000 [nofollow]

Advertisement: